Externalities are defined as costs (or benefits) of economic transactions that are borne (or enjoyed) by people who are not part of the transaction. Externalities are a market failure because they cause the prices of the goods to not reflect their true costs.
The reason that we assume there are no externalities in perfect competition is because it is sort of a model. So assuming no externalities is like assuming no friction in physics.
Perfect competition is supposed to cause there to be allocative efficiency -- it is the perfect market structure. So in order to have it be that way, you have to assume there are no externalities.
Externalities are activities that affect others for better or worse, without those others paying or being compensated for the activity. Externalities exist when private costs do not equal social cost or benefit (Samuelson and Nordhaus).
Externalities are divided in two major types - external economies and external diseconomies. the external economies result in production or consumption providing benefits to others without them paying for theses benefits. For example, the research and development conducted by companies for their own goods, also promotes general advance of technology and in this way benefits the whole society without all the beneficiaries specifically paying for it. Another example from common life is that when a person maintains his house and garden well, it also results in improvement of the look of the complete neighborhood, and perhaps increase in prices of the property there.
The external diseconomies result in production or consumption causing damage or loss to others without them being compensated for it. These include major issues like environmental pollution caused by production and consumption activities.
Externalities limit the ability of free competition or laissez-faire approach to automatically lead to promotion of the interest of whole society. When the market costs do not cover all the costs and benefits to the society, free competition tends to result in production of more of goods that result in external diseconomies and less of goods that result in external economies.
Samuelson, P.A. and Nordhaus W.D. 2005, Economics, Eighteenth Edition, Tata MxcGraw-Hill, New Delhi.