There are different methods of checking that a VAT number is correct.
You can check an EU VAT number (including the UK) on-line (http://ec.europa.eu/taxation_customs/vies/).
The EU data base is only updated monthly so including delays in the local Member States tax authorities the data could be 6 – 8 weeks out-of-date. As such a business may have registered for VAT but not be on the system yet or may have de-registered and still appear on the system.
For the UK you can ring the HMRC helpline: 0845 010 9000 open 8.00 am to 8.00 pm Monday to Friday.
You can also use a mathematical check that the number is correct.
To check that a UK VAT number is valid you should first check that it is 9 digits long. (This does not include the GB which is sometimes stated at the beginning). The first 7 digits are random numbers and the last 2 digits are based on a formula using the first 7 numbers. If the mathematical check works out it only shows that the VAT number is valid, not that it is proper to the business quoting it or that it has not been de-registered.