In PS (16) the Trio, headed to the Forbidden Corridor under the invisibility cloak, encounters Peeves, who hears them and says
Know you're there, even if I can't see you. Are you ghoulie or ghostie or wee student beastie?
and Harry decides to impersonate the Bloody Baron and answers
the Bloody Baron has his own reason for being invisible.
Now, a witch/wizard can, of course, hide through magic. What about ghosts and ghouls?
According to logic, I would say that only someone (something) physical and material can become (be made) invisible in the sense that it is not visible but is still physically there. However, on Pottermore ghosts are characterized as
transparent, three-dimensional imprint of a deceased witch or wizard, which continues to exist in the mortal world
and
Witches and wizards are much more susceptible to what Muggles call paranormal activity, and will see (and hear) ghosts plainly where a Muggle might only feel that a haunted place is cold or ‘creepy’. Muggles who insist that they see ghosts in perfect focus are either a) lying or b) wizards showing off – and in flagrant breach of the International Statute of Secrecy.
So ghosts are specters that can either be seen (as pale, translucent versions of their pre-death selves) or only felt. Who is able to see them could, at most, not see them in perfect focus. Throughout the books, it appears that Peeves - similar to witches/wizards - sees them and interacts with them, as implied by Harry's answer (he presents it as an exception). Why would the poltergeist then assume that out of the blue they could not be visible to him? Wouldn't this imply that ghosts can use magic to hide (also from witches/wizards then, which would contradict the solid characterization above)?
And why should ghouls be invisible? They have a corporeal appearance and have no magic powers.
Of course, it could be that Peeves asks the question this way simply because he can't see anybody in the dark of the night but given Harry's answer and the fact that Peeves believes him, the issue as pertains to ghosts remains. I'm curious if there is a good explanation other than assuming Peeves is stupid or too scared of the Bloody Baron to question Harry's answer.