There is an important conceptual distinction between a demerit good and a negative externality. A negative externality occurs when the consumption of a good has measurable negative consequences on others who do not consume the good themselves. Pollution (due, for example, to automobile use) is the canonical example of a negative externality. Another example is cigarettes. It not only affects you, but the people around you (second hand smoking). By contrast, a demerit good is viewed as undesirable because its consumption has negative effects upon the consumer.
Two fundamental views in welfare economics, welfarism and paternalism, differ in their conceptual treatment of 'demerit goods'. Simply, welfarism takes the individual's own perception of the utility of a good as the final judgement of the utility of the good for that person, and thereby disallows the concept of a 'demerit good' (while allowing the analysis of negative externalities). As an extreme example, if a heroin addict purchases heroin, they must have done so because heroin makes them better off, and this transaction is viewed as a net social positive (assuming that the addict does not commit any other crimes as the result of their addiction). Paternalism, on the other hand, judges that heroin "isn't good for you", and feels free to override the judgement of the addicts themselves (see 'Welfare Economics, Boadway and Bruce, Basil Blackwell 1984)