Breaking out of an elevator is inherently dangerous. Falls, getting ground between elevators or an elevator and the shaft, getting entangled in gears, belts or cables, exposed electrical gear and the chance the car moves when your halfway through the door are all possible outcomes of trying to get out on your own.
Sometimes staying put and waiting for rescue isn't an attractive option. Rescue can take hours. Time you might not have if the building is on fire or you suffer from one of the many time dependent diseases like diabetes.
On 9/11, according to the firefighters who survived and at least one photograph I have seen, several elevator cars were occupied. These had been directed to the ground floor. But in some cases the doors wouldn't open. The firemen, operating according to standard protocols, considered freeing the trapped people a low priority. They were thought to be trapped but otherwise safe. The building fell on them before they were freed.
These situations are pretty rare and the default has to be to wait but a person has to be aware of the limits of normal behavior and situations. And when it is best to eschew normal limits and to take risks in an attempt to save yourself.
Looking at a few elevator installations all of them had hatches in the ceiling. Often concealed above a false ceiling and lights. usually somewhat toward the back of the car. All these hatches had latches that were operable only from the outside. But don't be discouraged. All of the locks I saw were cheap, lightly constructed and attached with nothing but a few small screws. I have no doubts that a determined shove or kick would quickly overcome them.
Getting to the trapdoor in the ceiling is the hardest part. If the car has hand rails you can use those and the geometry of the corner to get into position. A little assistance from fellow passengers would also help.
What you do after that is too varied to make many recommendations. I will suggest that you be careful. Take it one step at a time. And that if you do get the outer doors open that you move as quickly as possible through the doorway to limit the chances of getting guillotined if the car should move.