By federal law, all modern elevators must have a switch lock to allow emergency services or law-enforcement officials to use the elevator in an emergency by locking out anyone else. Other methods can be used to lock an elevator, most of which require an experienced elevator technician.
Pull the "Off" switch in the elevator. While this doesn't prevent someone from walking into the elevator and turning it back on, it blocks people on other floors from using the elevator. Some elevators are set so the doors can be manually closed when turned off. If that is the case, closing the doors would probably prevent all usage of the elevator.
Turn off the elevator using a key that fits the switch lock installed in the elevator. Most elevators have a lock installed that looks a standard key lock. It usually turns the elevator on and off, overriding any requests from other floors. This is handy not only to turn the elevator off, but to travel from floor to floor without stopping. Keys are usually limited to the building's management or maintenance departments. Fire officials and some police departments also have master override keys that work in nearly every elevator lock.
Shut off the power to the elevator at the main breaker box. This move doesn't lock the elevator, but it does prevent the elevator from being used. Most breaker boxes allow you to selectively turn off power. Power can be cut to the main system while leaving lights and fans on in the elevator.
Lock the elevator door using a hoistway keyhole. All elevators have a keyhole in the outside door that allows building maintenance or fire officials to access the elevator shaft in case of an emergency. These keys are not universal, but each manufacturer only uses one key design. Locking the elevator door using this method will not prevent the elevator from working, but it does prevent anyone from using this specific door to gain access. To lock out all floors, perform the same lockout procedure on each door in the building.