Raycasting from mouse position downwards

I am trying to create a RTS style “placer” script that positions items on my map. Here is my code at the moment:

	Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
	RaycastHit hit;
 	if (Physics.Raycast(ray, out hit)){
		_mousePos = hit.point;
		_mousePos.y += _raycastHeight;
		RaycastHit groundHit;
		if(Physics.Raycast(_mousePos, Vector3.down, out groundHit, Mathf.Infinity, placementLayerMask)){
			placementIndicator.transform.position = groundHit.point;
		}
	}

It works ok but when I mouse over the sides of my map, the raycast is returning a hit. What I am trying to do here is get the mouse position, cast a ray downwards from the sky and only detect hits on the top surface of my map, not the sides.

Diagram of what I am trying to achieve

To illustrate what I am trying to achieve, I only want to detect hits on the red part of the cube.

Does anyone know how I can achieve something like this? Placing structures on the sides of things is pretty hilarious but definitely not desirable!

If the top face is strictly horizontal, you could do a different thing: check hit.normal.y - it should be ideally 1 in a horizontal surface. To avoid bad surprises due to float precision, you should accept hits with hit.normal.y > 0.999, for instance (the normal is a normalized vector, thus no component will be greater than 1):

    Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
    RaycastHit hit;
    if (Physics.Raycast(ray, out hit, placementLayerMask) && hit.normal.y > 0.999){
       placementIndicator.transform.position = hit.point;
    }

NOTE: Expressions connected by the && operator are evaluated from left to right, and only if necessary - if Raycast returns false, hit.normal.y isn’t tested, thus avoiding Null Reference Exception errors.