Praise be to Allah.
If divorce occurs, and the couple have a small daughter, the one who is most entitled to custody of this daughter is her mother, so long as she has not remarried.
Ibn al-Mundhir (may Allah have mercy on him) said:
All of the scholars from whom we acquired knowledge were unanimously agreed that if the spouses separate and they have a small child, the mother is more entitled to custody of him, so long as she has not remarried.
We narrated from Abu Bakr as-Siddeeq that he ruled against ‘Umar ibn al-Khattaab and ruled that ‘Aasim should be in the custody of his mother Umm ‘Aasim, and he said: Her lap, her smell and her touch better for him than you, until he grows older, then he can choose.
All of the scholars from whom we acquired knowledge were unanimously agreed that the mother has no right to custody of the child if she remarries.
We narrated from the Prophet (blessings and peace of Allah be upon him) that he said: “She is more deserving of having custody of the child so long as she has not remarried.”(Al-Ishraaf 5/171).
But this custody is a right of the mother, not a duty upon her. Therefore if there is someone who can take her place in having custody of the child, it is permissible for her to give up custody to someone else among the relatives of this girl.
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said:
Custody is the right of the one who has custody, but it is not a duty upon him. Based on that, if he wants to give it up to someone else who is less entitled, it is permissible for him to do that." (Ash-Sharh al-Mumti‘ 13/536).
Based on that:
If your giving up custody of this girl will not be detrimental to her interests, in the sense that there is someone who can take custody of her, such as her father and grandmother, for example, and there is someone who can breastfeed her, then there is no sin on you.
But if the child will not accept to breastfeed from anyone except you, then in this case you are obliged to breastfeed her, as has been noted previously in the answer to the question: Is it obligatory for the mother to breastfeed her child?
And Allah knows best.