The spatial clustering of X-ray selected AGN in the XMM-COSMOS field