Administrators and I think Moderators can see all users, regardless of status. So if someone has hidden their online status, you should still be able to see it and it will only be hidden to normal registered members.
"What would the database query be if I want to show everyone's online status?" made it sound like you wanted to see everyone who was online. I guess you want to force all users to be visible via a query.
That query would be:
UPDATE xf_user SET visible = 1
You would then probably want to remove the option in the template, which should be sufficient.