At what depth does the underground begin to warm up?
Your question has an incorrect assumption built in.  Near surface ground water temperatures are not generally colder, but rather reflect the average annual temperature. This will be colder than surface temps in summer, but warmer in winter.  There is an an additional effect if your rainfall isn't evenly distributed over the course of the year, as percolating rainfall will be initially warmed by warm soil temps in summer.  As an example, in central Alberta shallow well water temps run about 10 C, while our average temp for the year is around 4-5 C

Start here: https://www.builditsolar.com/Projects/Cooling/EarthTemperatures.htm

A graph on that page shows how soil temps vary with depth depending on seasonal variation, and moisture levels.  Ball park:  30 feet gets out out of the seasonal variation, but 12 feet eliminates about 2/3 of the annual variation.

If your climate is cold enough in winter, it may be worth your while to store coolth in the form of brine.  In effect build a well insulated building with insulated foundation with what amounts to a swimming pool in it filled with either salt water brine, or calcium chloride brine.  Have a few thousand feet of 1/2" plastic pipe (drip irrigation pipe is cheap)  both outside and in the pool, and circulate antifreeze through the pipe when winter temps are below the brine temp.  In the summer, a secondary loop circulates between the pool and the heat exchangers for the house.

If you are in a desert climate, you may be able to do something similar on a smaller scale.  Under a calm clear sky, you can often get frost on the side of an insulator facing the dark sky at night.  Modifying this idea, create a large bottom insulated surface coated with a good IR emitter (Titanium dioxide white is one such.) , and run shallow water over it.  If you can routinely get 30 C colder than day time air temps, then you only have to store a few days worth of coolth instead of a years worth.

You can make the system above colder by pre-chilling the water with an evaporative cooler

Edit:  One source claims 1 degree F per 30 feet starting at around 100 feet.  Temperatures above this 
however are highly variable from water movement.