"How can I determine if something is not inside the tree?"

for ball in get_tree().get_nodes_in_group(“Ball”):
if not ball.is_inside_tree() :

I believe get_nodes_in_group will only return items in the tree. You are correct use the is_inside_tree() function

Indeed they must be in the tree, there’s no way to get nodes of a particular group not inside the tree, see the latest documentation