Level Zero by Jaron Lee Knuth

The never-ending wars, pollution, and overpopulation of the near future have caused the outdoors to become uninhabitable, and the government is forced to create a new world, a virtual existence that allows civilization to continue. Shopping malls, schools, concert venues, and religious gathering places all exist in the infinite confines of this new reality, yet the most popular domain for most teenagers is the one that houses the endless array of digital games. When the sequel to a popular title is released to the public for a special beta test, a group of players eagerly log in to try out the new experience. What seems like harmless violence quickly turns all too consequential when the players realize the game's biggest error: They can't log out. Forced to battle their way through an endless army of monsters programmed to kill their avatars, the players must fight against the clock and find a way out of the game before the real world catches up to them.