Say you're a starting a startup and want to keep your costs down, as well as well.. live in the office where you create software. Plus, it's a lot cheaper to rent a private office than to rent a studio.
So, what is the general view on such things in San Francisco? Is it strictly prohibited in many offices? What differs "living" from just accidentally falling asleep during an all-nighter?
I'm not sure where you'd be able to find a "private" office in SF which is cheaper than a studio and where people aren't going to notice that you are living there. The cheap offices are usually larger office spaces split up. I.e. close quarters. It's the neighbors you need to worry about, not the landlord.
Keep in mind that a net connection is also more expensive at an office, you'll need a gym membership in order to take a shower, eat out every meal, regular chiropractor visits, psychotherapy sessions, etc. If you add it all up you probably won't be saving any money.