Yes. The DM has to provide a reason why the PCs can't rest. Resting invites more danger or loss of precious time or some such. It also, IMO, requires a bit of player buy-in.
In a game I am playing in currently, we have sneaked into a fortification to steal something while our allies attack...