although the judgement says it was a son, the OPR said it was a daughter called Mary. I can't find this child anywhere.
This appears to be self-contradictory. If you know what the OPR says, then you have, by definition, found the child.
I wonder whether you are confusing Mary, baptised in Dalry, Ayrshire, on 9 March 1841 to Robert Kennedy and Jane
t Hewitson, with the older child Robert Kennedy, who appears in the 1841 census aged 1, suggesting a birth in 1839 or 1840, and in the 1851 census aged 10, implying a birth in 1840 or 1841.
What exactly does Mary Kennedy's baptism record say?
I see from
ev's reply #6 above that Robert was born on 16 April 1840.
Mary was baptised 11 months later so there should be no confusion.
I
speculate that the timeline goes something like this
1840 Birth of Robert Kennedy Jr
1841 Birth of Mary Kennedy
1841 or 1842 Death of Mary Kennedy. The absence of a record of the death is immaterial; most deaths before 1855 went unrecorded.
1843 Marriage of James Muirhead and Jane
t H*w*tson
1843 James Muirhead and Jane(t) H*w*tson pursue Robert Kennedy Sr for the upkeep of his child Robert Kennedy Jr.
Obviously, if the child Mary was a sibling of Robert Jr, they would have pursued him for upkeep of both children, but if Mary had died in infancy it would explain (a) your confusion (b) why her stepfather and mother did not pursue her father for upkeep and (c) why Jane(t) named her daughter by James Muirhead Mary; she had no living older child of the same name and wished to name her eldest daughter after her own mother.
If, however, Mary was not a sibling, then she is irrelevant.