It happens occasionally. Humans make mistakes.
I had a room assigned a couple of days ago where the front desk initially told me 307, then, no, it's 304. Of course the key opened 307 not 304, so I called the desk, but also put a note on the door stating it was occupied as well as hanging the DND door sign.
And of course you lock the door.