Some children very easily get into believing that they are going to fail. Then they won't even have a go, because they think that they are likely to fail.
So how did this belief arise? Don't take it on yourself, as a parent. It may have been the simplest thing. It may have been a little time when they couldn't succeed at something they expected to do easily. And you may have been nowhere near.
Children pick up beliefs from the circumstances, from the people around them, from their own thoughts and from the emotions they feel. Once these start playing out correctly, then the belief is reinforced, and grows to affect many situations.
So when you notice that a child is unwilling to try what can you do?
In this specific moment, please play it down. Say ok, not now then. And maybe you start doing it. If the situation is light and they feel that their desire not to try is respected, they may well relax. And they may well decide that they can take over from you and continue the task.
Some people, and particularly teachers, decide to adopt a programme that teaches children that its ok to fail. This usually involves a mini lecture about how we all fail and its ok, and we learn from our mistakes.
Really this is too general and to the child, just sounds like a put down.
Golden rule, be specific. If a child has failed to succeed in a task, ask yourself did you see what the child did? If you didn't then some reassurance about maybe it will work next time, is best. Keep it light. And leave your anxiety out of your voice and your thoughts. We all know that things work sometimes and not at others. Regardless of how good at the task we are. And children are at an earlier stage of learning than us adults.
So now, the key thing is to be there and observe what is happening. Then you can notice which parts the child does correctly, or in which part the child came up with some possible problem solving. This is what you need to focus on and what you can encourage your child to focus on. Give specific feedback on the part they successfully did. This builds their confidence.
Forget lecturing (explaining!) to them that its ok to fail. It really doesn't have any weight in getting them to change their beliefs about themselves. The opposite actually.
Notice the little bits that they do succeed with, and comment on those. Not that it was good either. Don't judge part of a task as good. (They might think the rest is bad!) But that what the child did then, worked. This directs their attention to the specific part or task, in a way that encourages thoughts about the task, rather than whether they are good enough to do it. Maybe you can say why it worked.
If a child is stuck in not giving things a go, work with them. Have turns. Have them guide your hand. Laugh. Make it light. "We did it!" Leave pressure about next time, out of the picture.