African parents are abandoning their children in Spain so they can be taken into care as refugees, officials have said.