TIP #1: BARRIER FRUSTRATION BARKING
This type of barking often comes with posturing such as snarling or baring of teeth. The three most common occurrences are: Dogs left in a backyard too long, dogs in cars, or dogs on leash that would be perfectly comfortable with whatever they are barking at (most often other dogs) if they were off leash.
With very social dogs, more time spent playing with other dogs and less time spent behind a barrier will greatly improve the problem. Not-so-social dogs first need to learn to enjoy other dogs. In the meantime, avoid unsupervised time in the yard or car.
In either case, always give your dog a treat when he sees another dog but can’t say hi.
TIP #2: RESOURCE GUARDING COMES IN MANY FORMS
The catch-all, technical term of "resource-guarding" can include guarding of dog food bowls (or food), place (dog crate, dog bed, sofa, etc.) items (rawhide, bones, balls, tissues, etc.) and less commonly, people.
Resource-guarding simply means that a dog gets uncomfortable when we (or other animals) are around him when he has "his stuff." He's nervous that we're going to take it away, so he tries to warn us off in a variety of ways, ranging from simply consuming his food faster, to an all-out bite.
During resource-guarding, dogs exhibit components of ritualized aggression. That is, they have a fairly explicit hierarchy of warnings - accelerated eating, cessation of eating or "freezing up," glassy/hard eyes, growling, lip lifting, snapping, biting - that they'll run through to get a competitor (YOU!) to back away from what they have. They're nervous that you're there and don't want to share.
A dog can move from a growl to a serious bite in a matter of seconds. That's why trainers often hear the cry, "he bit without warning!" More often than not, there was a warning, somewhere, sometime - we just missed it.
- Whole Dog Journal
Jeff Dentler, CPDT-KA, IAABC-ADT, FFCP, CTDI