Have you tried checking the root
Viewport's boundaries against the second player's position? For example:
# Do this check when the second player moves.
if player2.position > get_tree().get_root().size:
print("Player 2 is out of bounds.")
I don't know whether this will work, but it's a start.