Can ants feel pain?
Ants perceive noxious stimuli in a very similar fashion to mammals, when damaged they produce substance P, serotonin, dopamine, and acetyl-choline which are neurotransmitters linked to pain perception in humans, and the amount of these chemicals produced can be reduced by opiates.
Conclusion: Ants feel pain.
Are ants emotionally affected by pain?
Ant behaviour is persistently affected by the experience of pain by reduced activity and feeding very similarly to a depressed person. Ants avoid further contact with the noxious stimulus after 2-3 experiences.
Severely/mortally injured ants receive care and communication from their sisters, up to and including antenna contact (analogous to hand-holding) whilst another ant stealthily provides euthanasia.
Conclusion: Ants are emotionally affected by pain.
But seriously, why would you genocide ants in your garden, they are a necessary and positive part of the ecology, aerating soil, removing biological debris that can cause harmful moulds and predating slugs, snails etc