Commander William T. Riker: In your position it's important to ask yourself one question: what would Picard do?
Wesley Crusher: He'd listen to everyone's opinion and then make his own decision.
Capt. Picard: Tea, Earl Grey, hot.
Capt. Picard: Engage!
Lt. Cmdr. Data: If the warp drive fails to activate, the results could be... Unfortunate.
Lieutenant Worf: Very unfortunate. We will be dead.
Capt. Picard: Make it so.
Answer: Yes. The doors to the holodecks can be locked when in use by anyone aboard the Enterprise so they couldn't be disturbed. However, high ranking officers like Captain Picard could override the doors as it's seen that overrides are in use even for the crews quarters. Even Barclay, when he's indulging in one of his fantasies could have the doors to the holodeck unlocked by an override code.