closing a room until the right time

Is it possible to have a room but make it so the player cannot go through until they’ve persuaded a guard to pass or done some other stipulation?

Yes! I’m not sure whether you want to prevent the player from going to the room or leaving the room, but neither is too complicated. You can write:

Instead of going to the Vault when the guard is not happy: say "The guard stops you and says 'You're not coming in here, buster."

or

Instead of going from the Prison Cell when the guard is not happy: say "The guard stops you and says 'You're staying right here.'"

And if you want code for how to make the guard happy, it could be something like this (untested, so I may have goofed the syntax a little):

The guard can be happy. The guard is not happy. Instead of singing in the presence of the guard: say "The guard wipes a tear from his eye and says, 'Ah, a song like that, it reminds me of me old ma. You may go, and good luck to you."; now the guard is happy.

Of course, for that to work, you want the guard to be in the room you’re in!

Section 7.13 of the documentation has more on some of the subtleties of “going from” and “going in,” and example 101 does pretty much what you’re looking for (except it blocks you from going to a region rather than a room).

That did the trick, thank you!