Patient: "Am I on an involuntary hold?"
Nurse: "No, you are here voluntarily."
Patient: "Um, I've changed my mind about being here and I choose to leave. I understand that I am doing so against medical advice and that doing so places me at risk for relapse as well as acute conditions possibly leading to permanent injury, disability, or even death. I acknowledge those risks and voluntarily accept them. Despite your urging me to stay, I choose to leave."
Nurse: "OK, I need to talk to the physician and to case management first."
Patient: "Am I being held here involuntarily?"
Nurse: "No, you are not on an involuntary hold."
Patient: "Then I choose to leave... right now."
At this point in the conversation, any attempt to prevent the patient from leaving (that is, physically or chemically restraining them in any way - and yes, locked doors count) would likely constitute false imprisonment as well as assault and battery. If you have reason to question their capacity to make the decision for themselves, you'd better be able to clearly articulate it.
Personally, I'd step out of their way and notify the charge nurse and physician... but I would not touch them nor in any way try to prevent them from leaving. If the person controlling the locks wants to take on the false imprisonment issue, so be it. If I were the one controlling the locks, I'd unlock them and encourage them to return at any time without prejudice.