As for the ḥadith, it is weak and cannot be used as proof.
Some scholars argued that the reason prayer is forbidden—and deemed invalid—in camel resting-grounds is the impure nature of the place. Their opinion is built on the claim that all animal droppings and urine are impure, whether the animal is lawful to eat or not.
This view is weak and runs counter to sound evidence, for the excretions of animals whose meat is lawful are pure. The Prophet ﷺ instructed the al-ʿUraniyyīn to drink camel urine; had it been impure, he would not have permitted it. Even if dire necessity had justified the permission, the Prophet would still have ordered them to guard against the impurity and to wash it from their mouths, clothes, vessels, and so on, and it is impermissible for clarification to be delayed beyond the time of need.
Others maintain that the rationale is purely devotional: its wisdom is unfathomable, and our only response is, “We hear and we obey.” The very command or prohibition of the Law is itself the cause and the wisdom, and that suffices the believer. The Exalted said, “It is not for a believing man or a believing woman, when Allah and His Messenger have decided a matter, to have any choice about their affair” ⦗al-Aḥzāb 33:36⦘. Thus, submission, compliance, and firm faith are obligatory, with the conviction that Allah has legislated nothing except for a benefit, an advantage, and a wisdom—whether manifest or hidden.
A third group of scholars held that the reason for the ruling on camel resting-grounds is the same reason behind the command to renew ablution after eating their meat: camels have devils that accompany them and take shelter in their watering places. For that reason, herdsmen and those who handle camels are noted for arrogance and self-importance, traits acquired from close association with them.
Accordingly, prayer is invalid in places frequented by devils. Allah knows best.
***