He/she dies when all of their ships are eliminated (whether it would be docked or undocked). The only way to find out is to loop through all ships and retrieve their owner (through getOwner).
One important aspect to note when checking for such conditions is that:
For almost every starter package, new instances of "Ship" and "Planet" are created every turn, and are NOT reused.
If you want to keep track if ships and planets, it is better to use their id's (ship.getId() or planet.getId()) not only because of the reason above, but also because it's more memory efficient. When you want to get the ship or planet object the following turn, you can use gameMap.getMyPlayer().getShip(shipId) or gameMap.getPlanet(planetId).