There is a major difference between being "alone" and being "lonely". It's possible to be in a crowded room or even married and feel lonely.
Being lonely is a "feeling" or a "state of mind" that there is no (connection) between you and other people. By constrast a person who is "alone" may enjoy their "me time".
People that truly feel "lonely" over a long period of time often are unwilling to take interest in others. Very often they are introverts and uncomfortable with initiating contact with others. For some people loneliness is a self-imposed prison. Maybe there are negative or stressful things going on in their lives where they (choose) to internalize their problems instead to discussing them with friends or family. This person becomes "emotionally ostracized" as they withold their issues from others. They could feel lonely in a crowd of a thousand people celebrating life.
If I am alone I can always call friends and meet them somewhere or I can go places where people are. Personally I have no problem going out to eat alone, seeing a movie alone, sitting in a bookstore alone, taking a stroll along the beach or in park alone, shopping alone, doing some people watching while listening to music on my iPod.
If I'm feeling (lonely) then I try and figure out why that is. In a world with Internet connections, family, friends, neighbors, and co-workers...etc more often than not when we feel lonely we are actually feeling "depressed". The only cure I've found for depression is taking action.