If the owner says "yes", then your next most important step is to ask the dog. If the dog is wagging his tail, feeling relaxed, coming towards you making gentle contact - then you may pat the dog. If the dog says "no", how will you know that? If they turn away, hide behind their owner, growls, looks anxious, or nervous, barks, or is over excited. Don't push the dog to let you pat him - walk away and leave him alone.
If the dog gets down on the floor with his belly up, watch his tail and other body postures. This does not always mean the dog is submissive. Ask the owner to get the dog up.