In the story of Yusuf (peace be upon him), we read regarding the wife of al-'Azeez who tries to seduce Yusuf (peace be upon him). Allah informs us that she closes the doors [according to some mufassiroon there were seven], yet just two ayaat later we read that they ran to the door, where by she tore the shirt of Yusuf (peace be upon him) from the back.
Why did Yusuf (peace be upon him) run to the door knowing that the doors were closed in front of him? Because he wanted to show Allah that he did not want to involve himself in this sin, so he ran to the door trying to escape knowing the door was closed.
Similarly, if you are in a predicament where you have no way out, show Allah you want a escape route, show Allah you want to make an effort; and he will make a way for you.