Dogs hear and smell all sorts of things that are beyond human senses.
Just because a dog stares into space does not infer that its vision is focused os something you cannot see but your dog can. Far more likely is the fact that the dog is concentrating on one of its other senses - hearing and / or smell, so its vision is 'in neutral' as its brain processes stimuli from other senses.
In respect of Purple's post - the same applies. If a dog has its senses fixed on an external stimulus, a noise or smell of which you are unaware, the dog may well concentrate on that, to the point of ignoring anything else, including your call. the sound or smell may evoke a pleasant memory for your dog, and induce tail wagging,but the popular notion that your dog is able to see a ghost is probably just that - a notion, noithing more.