how to mask an object so that it emerges from the floor
This is how you do that:


The cube needs this material, you can exchange the diffuse shader by any node tree you want, but the last node must be the mix shader with the holdout and transparent depth as factor. 
The plane needs a transparent shader. Everywhere the cube would be visible through the transparent plane, it will be alpha.