One Likely Possibility: The inn-keeper lied and had a spare key. She was part of Gavin Elster's plan...
Kim Novak is first introduced as a wife of another character named Glavin Elster, a wealthy man whom hires "Scottie" Ferguson, a retired detective with vertigo, to "follow" her around, because he believes she is suicidal.
INT. GAVIN ELSTER'S OFFICE - (DAY)
A well-appointed office with a large window looking out upon a busy
shipyard. There are a couple of models of modern freighters in glass
cases, but more important, on the walls are many framed prints and
posters and maps relating to early California history; some from the
Mexican days, many from the Gold Rush days, many of San Francisco in
the Seventies and Eighties. Behind the desk sits Gavin Elster, a man
about Scottie's age, huskily built, slightly balding, with cool,
watchful eyes. He is beautifully tailored, and gives the sense of a
man who relishes money and knows how to use it. He sits quietly
watching Scottie, who stands staring out the window at the activity
of the shipyard. After a long moment:
As Scottie follows her, and gets to know her, he comes to believe that she is possessed by a ghost of a relative/descendant of the family, whom died in tragic circumstances. Eventually, as things escalate, Scottie BELIEVES that she is dead when she climbs an old Spanish mission tower and throws herself off!!
But as more events play out, viewers learn that women Scottie was following was not the real Mrs. Elster! Instead, it was all an elaborate scheme for Gavin Elster to be able to kill his real wife and that Scottie never made it to the top of the tower to really witness the act, as Elster and Judy throw the real wife's corpse off onto the roof below--but the incident took another toll on Scottie.
Some time passes and he ends up seeing and meeting the women named Judy Barton, whom was hired to play Elster's wife. And that's all I will say.
The plot holes of Scottie not being a better detective are suppose to be sustainable, because as the main character, he has vertigo prior to these events and the plan relies on the idea that Scottie will fall in love with [the fake] Madeline Elster, giving up in his skepticism.
It's true that one could draw other conclusions, such as: if she was complacent, wouldn't she have gone to the police when she discovered the truth?
Well, she might or might not. It relies on what we don't know about her and her relationships with either Judy and/or Gavin in general, but again Elster is wealthy respectable man in the shipping business, and "Madeline's death" is not seen (the first time) as a murder, but a SUICIDE. Being bought, doesn't mean she necessarily knew the the entire point of the scheme and could of believed "Madeline" committed suicide. After all Judy DOES know the point of Gavin's scheme and follows through on it. So, by the film's own logic, if one character can be bought, why can't another? Who says that either greed isn't a powerful motivator and/or that the inn-keeper has to have moral conscious? There is also always "fear of retaliation". The Inn-Keeper could either face jail-time being a kind of co-conspirator/accessory to murder or Elster could plot to murder her too! It's also possible that the truth is revealed post-film, since now Scottie knows the truth and the whole thing would in theory be further investigated,but again no proof within framework...
Judy's Letter To Scottie, Before She Rips It Up - Vertigo Script
JUDY'S VOICE Dearest Scottie ... and so you've found me. This is
the moment I dreaded and hoped for, -- wondering what I would
say and do if ever I saw you again, I wanted so to see you again.
Just once. Now I'll go and you can give up your search.
(pause) I want you to have peace of mind. You've nothing to
blame yourself for. You were the victim. I was the tool, you
were the victim of a man's plan to murder his wife. He chose me
to play the part because I looked like her; he dressed me up like
her. He was quite safe because she lived in the country and
rarely came to town. He chose you to be the witness. The
Carlotta story was part real, part invented to make you testify
that Madeleine wanted to kill herself. He knew of your illness;
he knew you would never get up the stairs of the tower. He
planned it so well; he made no mistakes. (pause) I made the
mistake. I fell in love. That wasn't part of the plan. I'm
still in love with you, and I want you so to love me. If I had
the nerve, I would stay and lie, hoping that I could make you
love me again, as I am for myself... and so forget the other and
forget the past. But I haven't the nerve to try...
The Metaphysical Front is really the only other possibility in that something magical happened at the Hotel, but that seems unlikely, because all of the film's metaphysical elements fall away to the psychological, as Madeline was always Judy pretending to be Madeline and seemingly pretending to be possessed, as she never gives any indication that something mysterious "did" happen to her outside of falling in love with Scottie also.
It seems to me that Hitchcock wanted us to understand that Elster was a mastermind and that the flaw in everything was that Judy loved Scottie back, not that the inn-keeper is some kind of loophole.