Survival mode, as Vince has mentioned, is probably what you want (although for team match (with four teams) isn't exact behavior as you described, "until a whole team is dead" (but rather until all but 1 (or 0) teams are dead)).
Unfortunately, a 'clean' method via scripting to restrict / manage respawning (imo) is not possible. It is, however, possible to set players back and forth from the spectator team to their true team (having it so when you are in the 'dead state', you are in spec, otherwise on the team); in this regard, yes, it is possible.