A market failure is when some economic structure prevents the market from achieving optimal efficiency. A critical part of how the market tends toward its optimal efficiency is via competition.
If there is no situation where more than one company could be profitable, you would have a monopoly but it wouldn't be a market failure, since that's the best you could do. Its entirely possible that this situation doesn't really exist.
If there's a situation where more than one company can be profitable, but that monopoly either has a government grant or uses violent coercion to keep its monopoly position, that is a case of government failure, since a government is either directly (with a grant) or indirectly (by failing to prevent violence) causing the monopoly.
Then you have situations where you have a structural, or natural monopoly, where every additional customer either reduces the cost of production or increases the value of the product (network effects). In certain cases, it may be unfeasible for another company to compete because the risk of failure is too high in comparison to the potential reward of success. For example, if you build a network of railroads in an area, the cost of building a new network might exceed the profits that company could expect to make. The monopoly could refuse to allow competitors to connect to its network, keeping its monopoly rents for itself. But if the situation were restructured where the monopoly was required to allow 3rd party connections, or if trains were operated only by companies that didn't own tracks, additional competition could improve the market. Since that almost never happens, a monopoly puts an opportunity cost on potential competitors, keeping them out of the market. This opportunity cost is in essence a negative externality, which is an obvious market failure.
The usual alleged market failure often associated with monopolies is the deadweight loss triangle that Ubiquitous mentioned. The idea is that the monopoly will set a price that's too high, such that the market loses out on some beneficial trades. But, it's been shown that practice of price discrimination (which is widespread in reality) eliminates this dead weight loss. More information on that can be found here: https://www.independent.org/pdf/tir/tir_10_3_02_shmanske.pdf
I wrote an article on market failure that included some analysis of monopolies: https://governology.substack.com/p/the-role-of-government-part-1