Well first of all you need to be located inside the realm to obtain object data (UPDATE packet which contains List<ObjectStatus>)
Second, the quests are seemingly random, so there is no way of telling if for example the "Ghost king" object is the last quest.
That said, there is the option of tracking down if and when a realm has closed, and connecting directly to the closed realm IP address (difficult to make, though)
But usually - if the only quests that are left are ghost kings/ancient ents/liches then the realm will probably close soon.