Eventually the Earth could become small and dense enough that the escape velocity from its surface would exceed the velocity of light. The velocity of light is an unavoidable universal speed limit. Nothing can go faster. The consequence is that if an object is small and dense enough, then not even light can escape its gravitational influence. If you get too close to a black hole you can never escape its gravity.
Gas falling onto neutron stars becomes hot and thus visible to outside observers.
The same is true for black holes. Nevertheless we can infer the existence of black holes by seeing this last gasp of light from the infalling gas. There are a few good candidates for black holes.