It has been out of order since 2003, four years before the series began, as told in "The Staircase Implementation" (S3E22) although Leonard once said two years previously in "The Nerdvana Annihilation" (S1E14). It had been broken ever since Leonard tested out an experimental rocket fuel formula which began to explode, with Sheldon saving Leonard's life after he tried to take the fuel outside by going down the elevator, but was stopped by Sheldon closing the elevator after taking Leonard out, in "The Staircase Implementation". It took 16 years, but the elevator was finally fixed by the time of "The Change Constant".
Ever since Penny moved in, she has had to take the stairs instead of using the broken elevator ("The Staircase Implementation"). Many people new to the building have tried to go in the elevator, before realizing it is broken, such as Zack Johnson ("The Lunar Excitation", S3E23), Beverly Hofstadter ("The Maternal Capacitance", S2E15) and Ramona Nowitzki ("The Cooper-Nowitzki Theorem", S2E06), although she was merely wondering why it hadn't been fixed. Howard once tried to fix the elevator, but upon inspection gave up immediately ("The Nerdvana Annihilation").
When Sheldon's mother, Mary, asks when his landlord is going to get the elevator fixed, he replies that he doesn't know; however, he wants to turn the elevator shaft into a missile silo in order to strike Burbank before they get them ("The Rhinitis Revelation", S5E06).
Instances of opening the elevator
In "The Nerdvana Annihilation" (S1E14), Leonard was dreaming about helping Penny get down the stairs when their time machine was blocking them. He ripped the warning signs off the elevator door, opened the door, grabbed the elevator cable, took Penny in his arms and descended on the cable while Penny kissed him as her hero.
In "The Jiminy Conjecture" (S3E02), Raj, Howard and Sheldon are searching for a cricket they had heard. Sheldon searches the bottom of the elevator shaft. After his friends run away after hearing the cricket, Sheldon is left in the elevator shaft in the dark when his flashlight gives out.
In "The Lunar Excitation" (S3E23), a drunk Leonard pushed the elevator door open a little and drop a wine bottle down, and from the time before the bottle hit the ground, he evaluated the height of the fourth floor is "thirty feet".
In "The Scavenger Vortex" (S7E03), Leonard pushed open the elevator door and searches the elevator shaft for a clue in the scavenger hunt that Raj planned.
In "The Change Constant" (S12E23), Sheldon and Leonard discover that the elevator has finally been fixed after 16 years when the elevator door opens and Penny is inside. Penny remarks on how long it took to do so.
In "The Stockholm Syndrome" (S12E24), now that the elevator IS repaired, when heading to the airport, the gang struggles to put all of their luggage and themselves into the elevator, until Leonard comes up with the idea to send the luggage in the elevator while they go down the stairs.