Here's a thing that is very common in adventure stories but is not necessarily the easiest to use in an adventure RPG: the heroes are captured and thrown into the actual dungeon (jail)!
Happens all the time in movies and TV shows. All. The. Time.
But in a traditional adventure RPG, what is the first thing that tends to happen when any NPC tries to lay a finger on a PC?
"I cast fireball."
"I throw my axe."
"I slip into the shadows so I can get a backstab next round."
Now, I'm of the mind that the GM should practice firm-but-gentle scene-framing. I think the GM has the power - nay - the responsibility to "force" PCs into certain situations if the alternative would lead to absurdity or certain doom.
I mean, players always assume the PCs can find a way to do anything. And that's great, because they are the heroes. But surely there are times that the party knows collectively when it should measure its words and actions and bide its time. Right?
But we covet our free will as gamers so furiously! Those magic items we carry are not separate things, they are PART OF US. The IDEA of some NPC just taking Hipcracker the +2 war hammer or Whipcakes the Staff of Power off our person and escorting us into a dirty cell? RIDICULOUS.
Of course the NPCs have to be careful. If you have 5 powerful entities in your throne room carrying such mystical magical items and possessing unknown magic powers... you might think twice before just saying "Throw them in the dungeon!"
So there's a caution for the GM as well.
But still. We need to have some cool "will they escape??" moments without "I skewer the first guard on my spear" as the default reaction.