Sayyiduna Abu Hurayrah (may Allah be pleased with him) says that the Messenger of Allah (peace and blessings be upon him) said: "The wound caused by an animal carries no liability, and a well also carries no liability." Hafs bin Umar added: "A mine also carries no liability, and in rikaz (buried treasure) is the khumus (one fifth)." The two Shaykhs recorded it in the Sahih from Shu'bah, and what he meant by it (Allah knows best) is a well that one digs on his own property, or in the desert, or on a clearly wide open road (it carries no liability). As for when one digs it somewhere other than these places, he will be liable for the damage. It is narrated from Sayyiduna Ali (may Allah be pleased with him) that whoever builds where he has no right, or digs a well on land not his own, will be liable.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الديات / 16395