Emphasize bravery for new programmers
When I was preparing to tutor a 13-year-old girl in programming, having only helped undergrads before, I did some light research to see what tone I should set. I came across this TED Talk:
Teach girls bravery, not perfection | Reshma Saujani
(Reshma Saujani is the founder of Girls Who Code.)
Saujani's thesis is that girls are socialized to be perfect, whereas boys are socialized to "play rough and climb to the top of the monkey bars". One study she cites found that grade 5 girls encountering material that was too difficult gave up whereas boys redoubled their efforts, despite the girls' overall superior academic performance. (In fact, the smarter the girl, the higher the chance she gave up.)
Now consider that programming requires a huge amount of trial and error both in writing and debugging, not only for learners but even for most professionals.
A scenario she describes at Girls Who Code sounds very much like your own student's:
We immediately see in our program our girls' fear of not getting it right, of not being perfect. Every Girls Who Code teacher tells me the same story: during the first week when the girls are learning how to code, a student will call her over and she'll say, "I don't know what code to write." The teacher will look at her screen and she'll see a blank text editor. If she didn't know any better, she'll think that her student spent the past 20 minutes just staring at the screen. But if she presses Undo a few times, she'll see that her student wrote code and then deleted it. She tried, she came close, but she didn't get it exactly right. Instead of showing the progress that she made, she'd rather show nothing at all.
She also mentions a pattern that reminds me of your student's "I suck at programming" comments:
When the guys are struggling with the assignment, they'll come in and they'll say, "Professor, there's something wrong with my code." The girls will come in and say, "Professor, there's something wrong with me."
Not everyone may agree with this assessment (the disheartening YouTube comments are evidence enough), and generalizations have exceptions. There's no guarantee that these observations apply to your student's case. But at a minimum, I think it would be a promising track to follow.
Let her know that mistakes are necessary steps to mastery and that progress is only made in this field by trial and error. The mistakes she'll make won't do any harm or damage the computer. But showing them to you will allow her to get past them.
Focus on the process, not the result. Praise growth, not (perceived) ability.
Throw in stories of your own history getting over these humps. Many students love to hear that their teacher wasn't always "all-knowing". They see that you're human and had the same problems as them. Ergo, they too can surmount them.
You can also do something like "My Favourite No", where you invite attempts from the students. You then identify the mistake whose correction is most likely to help everyone and go through it with the students. These days apps like Padlet would make it easy to do that anonymously.
As Kevin comments below, there are connections with growth vs. fixed mindsets and mastery vs. performance outlooks. There are also connections with attribution theory ("Whose fault is it when I fail? Who gets the credit when I succeed? Why did I fail or succeed?"). We know, for example, that helping students attribute success to effort rather than innate intelligence is a good predictor of willingness to take on new, harder tasks (itself a prerequisite for succeeding at them).
Appendix: filling in the air pockets
This doesn't mean a diminution of rigour. You don't need to say that mistakes are fine or can be ignored. Quite the contrary: Students have to make them because it's important to identify them. The mistakes aren't good; making them is.
I'll illustrate. I have another student, a 10-year-old boy* I'm teaching French. For a long time, he seemed to hate reading, even though he was pretty good at it. During one lesson he happened to make a remark that revealed the problem: "I'm not gonna read. I'll just make mistakes."
"So?" I said. "That's what I'm here for! I'm not here to listen to you already reading perfectly!"
I then made this impromptu drawing:
"This box is your understanding of how to read French," I said. "When we completely fill it in, you understand everything. But right now there are little bubbles — air pockets. Those are the gaps in your knowledge."
"Whenever you read, we're scanning this box. Every time we find a bubble, we 'pop' it. We talk about the mistake and practice till you get it. By the end, this is what we have."
I don't know if it would work with everyone, but it worked with him. He got over his fear of reading.
* Those who read this episode as proof that boys have the problem too can feel free. The pedagogical point is the same.