That might be a code where you live, but either it isn't universal or older places are exempt. My first apartment - which still rents out, decades later, had a small windowless bedroom with only a door for an exit. The nearest window was blocked by the kitchen sink.