what game system are you playing?

It makes a difference. If its something like D&D 5th edition then there is a lot you can do as it comes up. If it's 3rd edition I wouldbe suggesting ways to stall or other ways to manage it.

But generally...

1) Have a few pre-built locations. This is easier for me whenI play online through roll20 or similar, but works in person as well. Not finished, but things like building/treasure traps... who lives there and other details then added as they come up. Have the players land in a basement. Loadsof buildings have basements - you were going to use it sooner or later.

2) Stall. You know that really interesting NPC you wanted to introduce? Have them meet the party there - maybe a prisoner, maybe a guest, maybe another thief that challenges them to a heist-off. Have the party meet them and instead of exploring they spend the rest of the session having a chat, geting some exposition etc..

3) Subvert what they are doing. In 5th edition no powerful wizard would becaught without forbidance protecting their tower - so they can't teleport in but need to climb in. Taking the time to actually see the building and maybe understand a bit of what is inside it, might dissuade them from going any further.

4) Make them decide not to go - they want to sleep first, disrupt their sleep. Make other events and enemies catch up with them. Some things that could happen anytime happen now. Having a plot where a dozen things are happening at once means there are many more options for gently steering the party away from an action, not forever, but just for long enough you get time to prepare.