Take a calm assured posture. A firm voice and gradual departure are better than a retreat in panic. Include the nature of your surroundings in your reaction. As a last resort, lie face down, protect your neck with your hands and arms, and don't move. This requires considerable courage, but resistance would be futile.
Numerous incidents exist where a bear has sniffed and departed without serious injury.
Hiking in nature can be very rewarding. Keep to the trail, make noise, follow the rules and have fun. For further information and reading, check out the Yellowstone Backcountry Guide . Check out the Calf Creek Page for information on camping and hiking in Southern Utah.