In which case, can a Priest refuse to Baptize a Child

What is the essential purpose of baptizing an infant?
In this case, Catechism of the Catholic Church gave an answer to it (CCC 1257) that Christ Himself attested that baptism is necessary for salvation, (CCC 1250) went further to explain that even innocent children, who are born with original sin, need baptism to be freed from the power of darkness and to become children of God.
So the essential reason why Parents should want their children baptized is because they want them to be freed from original sin, and made members of the Church.
But unfortunately enough, in many cases nowadays, parents who ask for their children’s baptism do so only for cultural reasons rather than spiritual ones.
Often times, religiously indifferent parents ask for their child’s baptism just because they are being pressured by their own parents to have their child baptized. In such cases the spiritual importance of the sacrament of baptism is being lost.
The Church pleads to avoid situations in which a child is baptized a Catholic, but then, due to the negligence and indifference of his parents, is not raised to practice the Catholic faith and a priest would refuse to baptize that child.
As a result of this, (Can. 868.1) states that for a child to be baptized, there must be a realistic hope that he will be brought up in the Catholic religion. If such hope is lacking, the baptism is to be deferred and if, at some point in the future, the parents can provide basics for hope that their infant will in fact be raised as a Catholic, the priest may then proceed with the baptism.
For a priest to refuse baptism on an infant maybe in the case of the Parents not being fully prepared for the baptism of their own child. In this case, the Code of Canon Law (Can 843.2) states that of priests have the duty to ensure that those who ask for the sacraments are prepared for their reception.
In the case of parents who present their infant child for baptism, it is the parents who must be properly prepared, as they are asking for a sacrament on behalf of another person who is too young to request it for himself.
In order to avoid confusion and inconsistency, it has become the norm for U.S. dioceses and all diocese all over the world to require parishes to hold mandatory classes for parents requesting infant baptism, in order to make sure that
(1) truly, all parents understand the spiritual obligations that the baptism of their child will place on them, and
(2) the priest may have the opportunity to determine whether it may be unrealistic to think that the children of the parents attending the class will be raised as Catholics.
To attend such a class, and participating in it, shows the priest that parents are properly disposed for the baptism of their child; adamantly refusing to attend it may be interpreted as a sign that they are not ready for their child’s baptism.
However, (Can 851.2) says that the priest is required to see to it that the parents of a child who is meant to be baptized are suitably taught on the meaning of the Sacrament of Baptism and the obligations connected with it. And a mandatory class is an obvious way to do this.
Truly, it may require some inconvenience and sacrifice to make arrangements to leave the workplace so as to attend the class. But looking at the tremendous spiritual importance of the sacrament of baptism to a child, surely it will be well worth it!