You can't cancel the construction of the build by simply entering the building. The only option available there, is to finish it with diamonds.
Therefore you need to open the Build-Menu first. After that, please click on the Sell-Button on top which look like a $-Sign. After that click on the construction you want to cancel and simply sell the building:
You will get back all the inhabitants you used up for the construction but only a part of the used ressources.