Because the Atraxi scan the inhabitants of the Earth as well as the planet. The Doctor was also scanned so it saw footage of the foes the Doctor fought as well as his previous incarnations.
The Vashta Nerada are on Earth. The Doctor says so in "Silence in the Library".
We have not been shown the Hath on Earth but that doesn't mean they've not been here. Absence of evidence is not evidence of absence, as someone (with pointed ears) once said.