The title says it all: is there a maximum airfield elevation in which a Cessna 172P can operate? Or a maximum density altitude at which take off shouldn't be considered?
You should look in the POH for your specific aircraft (because it may have had modifications to it which would make it different from a "standard" aircraft) and see what it says.
Therefore, you can only go by the performance charts in the POH. According to the POH that I found above, assuming that you have enough runway available and can out climb any obstacles (big assumption, you need to make sure of this), you can takeoff at a pressure altitude of up to 8,000 ft. other than in cases where the airplane is very heavy and it is hot, in which case it will be restricted further.
This doesn't mean that the aircraft is not capable of taking off at a higher pressure/density altitude however, and if you have the need to do so then I would recommend contacting the manufacturer directly to see if they have any engineering data available for your situation (often they do but don't publish it; there may or may not be a fee).
I don't know of a maximum airfield elevation, though I suppose the airplane's service ceiling would qualify as an answer to this question. In regards to the second question, that is largely going to depend on the airfield elevation, runway length, climb gradients needed for obstacle clearance, and ambient atmospheric conditions.
These questions would have to be answered during your preflight performance calculations. You're going to have to consult the pilots operating handbook and cross reference the performance charts listed for both the takeoff distance and climb performance with information in the airport/facilities directory for the elevation, runway length, and departure procedures plus information from your weather briefing.
As an example calculation - and I'm using the CE-172S POH for this - let's say you are departing Lake Co Airport KLXV in Leadville, CO flying to Central Colorado Regional KAEJ. AWOS at KLXV reports Winds 220 deg at 7 kts with good visibility, temperature 21deg C/69deg F, local altimeter is 30.47" Hg, and Density Altitude is 12,262 ft. In these conditions, the POH doesn't even report a takeoff distance above and 8000 ft pressure altitude. The aircraft's service ceiling is approx 12,500 ft, meaning even if the pilot could somehow get airborne and fight his way out of the ground effect, he would still be able to climb at an anemic 100 FPM max, unacceptable for any kind of maneuvering and obstacle clearance. It would be an extremely hazardous exercise to attempt a takeoff at this airport under these conditions.
Another example: let's say we're are departing Ogden-Hinckley KOGD in Ogden, UT on an IFR flight plan to Fanning Field KIDA in Idaho Falls, ID. KOGD ATIS reports winds 129deg at 6 kts, temp 30deg C/86deg F, altimeter 29.98" Hg., and a density altitude of 7,101 feet. The winds favor RWY 16, which is 5,195 feet in length. Assuming we are fully loaded at 2550lbs, using the performance chart for the takeoff roll, at a pressure altitude of 8000 ft (to be on the safe side) and temp of 15deg C (remember, this is what density altitude represents), we find a needed short field takeoff roll, flaps 10 deg, paved level runway of 1995 ft in still air. The POH suggest reducing takeoff roll by 10% for every 9 kts of headwind. Here we have a ~4 kt headwind component, so we can extrapolate a takeoff roll of 1907 ft in these conditions. I like to use an additional 20% safety margain, which give us a final takeoff roll of 2288 ft. RWY 16 at KOGD is 5,195ft with no obstacle clearance procedures required. Your maximum rate of climb would be about 410 FPM as interpolated from the charts - pretty lackluster and again using a 20% margin of safety give 328 FPM this becomes even slimmer. This flight would not be recommended if you had terrain or obstacles to quickly climb over, and the routes to our destination require at least a 10,000ft MEA enroute. Instrument flight would not be recommended today doe to lack of aircraft performance for the required route. A VFR flight up through the valleys by Logan, Downing and Preston might be possible however.