Will ammonia deter dogs from pooping?

No and it will encourage them to pee there as well. It can also poison them as well. There are many good sites on house breaking a dog try and use more modern behavioral techniques.