No sorry, you misunderstood my question, or I wasnt clear.
We are selling the equipment so we issue the invoice for the prepayment + VAT (and at a later stage pay it to HMRC)
If however the kit doesnt work or is not accepted by the customer, he then claims from the bank guarantee and gets his money back + VAT from them.
Question is : how to we claim the VAT back we paid HMRC without an input invoice ?
Oh, that is easy Nick. What you have done is put the VAT received, and presumably passed to HMRC in due course, in your books of account. If it all goes pear shaped you merely reduce the output tax on later transactions and thus recover the VAT which actually isn't due to HMRC on a sale which effectively did not occur.
In fact that is how one adjusts VAT errors in any case by changing later returns to reflect reality. Make sure that you have an audit trail, which could be provided for by issuing a credit note to reverse the invoice, in the event of some future inquiry. It is, in fact, surprisingly simple.
So sorry I got it the wrong way around first time!