You can plan all you want, and as carefully as you want, but sometimes there's no way to do the job without some sacrifices. Sometimes, in fact, there's no way to do the job at all. Like the Kobayashi Maru test, only for real, not merely a training exercise.
However, in a roleplaying scenario, you need not fear setting up unwinnable scenarios. Because, when it comes right down to it, you can never take into account all the sneaky things a group of desperate PCs can get up to. The third option is always there; even if you can't see it, they will.
In fact, this can be an interesting way to design scenarios. Send the PCs into a death trap from which there is no escape. Then watch them escape.
R2-D2: Ding! Vector calculations complete. You're welcome.
Luke: Transmit them!
R2-D2: Guys, if you had the faintest inkling how complicated these were, you'd be amazed I did it so quickly.
Luke: Freaking transmit them already!
R2-D2: Sheesh, I sent them, like, eight whole seconds ago.
R2-D2: All the fighters are moving to my groove now.
R2-D2: Not everyone will like it, but it is the optimal plan.
R2-D2: Sorry, Porkins.
C-3PO: I mean: He said, "What?"