Voiding an invoice turns allocated payments into credit and doesn't erase the invoice, but rather archives it for audit and fraud prevention purposes.
Go to Accounts > Invoices.
Select and open the invoice you want to void.
Click on the Status drop-down menu and select Void, then Save
You can view the voided invoices by going to Accounts > Invoices and toggling Show voided at the top right to on.