I have a son who is eleven years old. He reads most of his books on his own, but sometimes, just for fun, I read a chapter or two to him at night – or I even read some of his Middle Grade fiction myself, if it looks interesting.
So I have read a lot of Middle Grade books in the last years, and what really surprises me is how often the protagonists in these books have lost their parents! This trope begins with Frodo, who grew up with his uncle, and continues to Alex Rider, who grew up with – you won't guess it! – his uncle.
I don't think there is a problem with a Middle Grade character who has lost their parents, but it begins to weigh on my son that about half the kids he reads about are orphans. He has begun to express concern that I might die!
So if you are writing Middle Grade fiction, I'd be very grateful to you – and I am sure many other parents and their children will be as well – if you would allow your protagonist to have parents that do not die.
Now, if I understand you correctly, you are not writing Middle Grade fiction. So having a few parents die should be no problem, right?
Only if you handle it right.
I have read a lot of books in which characters experience the death of a loved one, and I am apalled at how little most characters are affected by this. They cry a bit, and then they go on with their lives, almost as if nothing had happened. It always seems to me as if the writers didn't understand the incapacitating effect that the death of a loved one has on most people.
For most people, the death of a parent, child, or lover – especially if the death was violent and premature – is a traumatic experience, and many never get over it without psychotherapy, and some not even then.
So if you write a character whose parents are killed in the course of your story, you must consider that this person will be fundamentally affected by this experience and will most probably need more time to get over it than your story lasts. And this makes certain events in your story unlikely after that death. The protagonist will probably not fall in love in the week after their mother died. They may be so sticken that they are unable to go to work. If they were present when their parents were killed, it is highly unlikely that they came out of this experience unscathed. Read about PTSD, if you want to learn how people normally react to extreme trauma.
Of course there are people who are not affected by the death of their parents, but these people are special. Their relationships to their parents was so bad that they are relieved instead of sad. Or they are emotionally cold and unable to empathize. In any way, you need to motivate why they can go on as if nothing had happened.
I find all this so difficult that I have avoided the death of loved ones in the books that I have written. And I throw away all the books that don't handle this well.