This is an expense as a result of you not being able to collect the entire amount from your customer that you had sitting in the money you're owed account. You should only ever write these debts off after all reasonable efforts have been made to get paid.
When you deliver services or goods to a client, invoice them for the work or goods and they refuse to pay you or they go bust as a company. You should write off the amount that you had outstanding from them as a bad debt.
What's not included
When you reverse an invoice because you raised it for the wrong amount, this is not classed as a bad debt.
How is it taxed?
The bad debt is classed as an expense and a deduction from your pre-tax profits in the year it is incurred.
HMRC could ask you for evidence of attempts to collect the amount from your client, so please keep a record of evidence.