When a market completely fails to provide a good or service. This is largely restricted to pure public goods e.g. defence.
Below is a diagram to illustrate market failure which is created with pure public goods such as national defence. There is market failure because despite a demand for these types of goods nobody in the market is willing to supply them because of the free-rider problem.