Re-watching this scene (one of the best sequences in Star Trek!) I noticed the crew of the Spacedock's control center is mysteriously absent as the Enterprise is heading towards the space doors.
Was there no night shift at Spacedock? It seems unlikely. Or did Kirk manage to lure them away, or lock them in a closet, while he stole the Enterprise? If the crew were present they likely could have prevented the space doors being opened.