How can we know for certain that we are not in a dream?
I suppose you can't be 100% sure, because our understanding of dreams, consciousness, and our very existence is still lacking. That said, we are very adapt at identifying whether we are in what we perceive as the dream state or what we perceive as the waking state.
If, for a second, we can all agree that the waking world is part of a three dimensional, physical universe and dreams are a hallucinatory experience that occurs during the REM stage of sleep, then there are a few tricks that can help us know if we're awake or dreaming. These tricks are often referred to as reality checks. Due to the fluid and inconsistent nature of dreams, we can employ various techniques that help us detect "where" we are.
Here are a couple:
1. Read something, then turn away. Now turn back, does it say the same thing? In the dream world, words and numbers often change when unsupervised.
2. Jump. Do you "fall" or “float” back to the ground? In the dream world, gravity can act a little different than it does in the waking world. Things are often a bit more sluggish when we're dreaming.
3. Try pushing your finger through your hand, does it go through? In the dream world, our "dream body" is just as mailable as the surroundings. This often allows, for objects to pass through us.
4. Speaking of hands, look at them. Can you see them? Sometimes in the dream world, we don't actually have a body.
5. Seriously ask yourself this question: am I dreaming? It might seem silly, but try to retrace the past couple minutes/hours of your life, do they make sense? Are they logical? Dreams can be very strange, but despite that, we still view dreams as "real" when we’re in them, because we're not actively questioning our surroundings.