Naturally, the device won't be bothered by lava and water. Simply place the quarry block on the ground, tap on it and it will show you the size of the area that needs to be clear of blocks for the quarry to build. For the quarry to be built you must hit one of the four screens that will appear around that area until it turns green, if the screen remains red it means that there are blocks in the construction area.