Selecting faces not covered by other objects
As @lemon has commented, an alternative method for generating the raw texture might be to temporarily disable all your lighting, replace with a Sun lamp pointing vertically down in Z, and (using Cycles) bake a shadow map, as shown on the left.



If you set the angle of the lamp wide, to get a soft shadow map, you can have some control over the margin between the buildings and the trees, by putting the texture through a color ramp, and out into an Emission shader. You can then re-bake the resulting Emission.

Optionally, retouching can all be done inside Blender, using Texture Paint.