The dealer does not have to trade the car if they don't want. If they think they can sell it, they will keep it and sell it for profit.
If it's not a production restricted model, you'll have better luck trading. Likewise, if each dealer wants a car the other has. But if dealer B knows you're the customer dealer A is sourcing for, depending on the person calling the shots at dealer B, they may not give it up.