Ecclefechan is in the parish of Hoddom, so the 40-year-old Mary Ann Dalrymple in 1891 at Muirbank, Hoddom would certainly fit.
The 1891 transcription I'm looking at doesn't say where in Dumfries-shire she was born.
She is a near match to the 1861 listing in Annan of Mary Ann Dalrymple, aged 9, granddaughter of John D and Mary Rae, except that this gives her birthplace as Middlebie.
This also matches Mary Ann D, dairymaid, aged 30, born Middlebie, in the household of Peter Carruthers in Cummertrees in 1881.
In 1861 there is also a grandson John D, aged 1, born Annan. This looks like John Rae Dalrymple, son of William Rae Dalrymple and Janet Lawson, born 16 June 1859 in Annan. William R Dalrymple and Janet Lawson were married in Annan in 1850. They also had a daughter Mary Ann, born in Middlebie in 1852 (SP index says 1832 but it's wrong - I've reported it).
Mary Ann Dalrymple, mother's maiden surname Lawson, died in Dumfries in 1905, aged 51.
So I think that the mother of William Beattie Dalyrmple was the daughter of William Rae D and granddaughter of John D and Mary Rae.
EDIT (Posted before I saw Millmoor's most recent post. I'm glad to have my hypothesis confirmed!)