The pit, as was shown in the film, is located in Jodhpur, Rajasthan, India. In the brief moment when Talia al Ghul comes out of it, one can see the Mehranghar Fort in the background.
Even Confirmed from Wkipedia
The third movie of The Dark Knight trilogy, The Dark Knight Rises, was
partially shot around the Mehrangarh fort. A few scenes included the
prison well within which Bruce Wayne is shown to have been imprisoned.
There is one particular shot when Wayne emerges from the prison that
actually gives a glimpse of the Mehrangarh Fort in the background.
The scene involving Ras al Ghul also seem to be filmed in fort.
The inside of the pit is a famous Step well called Chand Baori which is in Dausa district, Rajasthan, India.(Borrowed answer from Quora).