these steps describe the steps to unmount an datastore from an ESXi host. If you tried it with the GUI and you got an error:
The resource ‘my_esxdatastore’ is in use. Cannot unmount volume ‘esxdatastore_F00’ because “One or more virtual machines are still registered on it”.
Continue reading VMware: Unmount a datastore/volume from an ESXi Server at command line