Boredom/Loneliness: Dogs are pack animals.
Dogs left alone for long periods, whether in the house or in the yard, can become bored or sad and often will bark because they are unhappy.
Separation Anxiety/Compulsive Barking: Dogs with separation anxiety often bark excessively when left alone.