What is the maximum number of average sized people that can stand in a standard upstairs bedroom of 12' x12'?
Design is based on “working stress” and “ultimate stress”. 

Working stress design accounts for many factors, including repetitive loading, short duration loading, etc. So, when the Building Code requires 40 lbs. per square foot LIVE LOAD, it is also adding in DEAD LOAD (weight of flooring, etc.,) short duration loading (Live load for less than 7 days), repetitive joist construction (single loads are rated lower).

Ultimate stress design calculates the maximum load (for live and dead load combined) before failure. Often this method is used, but then a “factor of safety” is used (such as 2) so there isn’t a failure. 

You’re asking for the maximum number of people, but not accounting for length of stay, dead load, etc. 

Also, are these people standing on the furniture, no furniture in room, hips touching, etc.? The code assumes a certain amount of furniture, circulation, etc. 

Btw, at 40 psf, I’d assume about 36 MAXIMUM people. That’s 144 sf / 4 = 36. But they’d be in the room for less than 1 hour...depending on the species and grade of your lumber and size (thickness) of you subfloor, etc.