Can I hide my bachelor and master degrees in CV when I apply for a PhD position?
No. You should not hide anything that you have done -- in academic programs or in work experience.  It doesn't matter whether you think that it is or is not related to the PhD application.  

If you made mistakes, then address them directly in your application essay.  What were the mistakes? What did you learn from these past mistakes?  Who are you now, given your experience in these mistakes?

In my opinion, if you aren't able or willing to talk about these "mistakes", then you aren't ready to enter a PhD program.

EDIT

My suggestion reflects a particular moral and ethical code, and it also reflects a certain culture (US Science, Engineering, and Social Science programs). It may not be appropriate in other cultures, and it may not suit your morals and ethics.

To the folks who recommend "only focus on the positives", my reply is "good luck with that".  In my experience, admission committees (and hiring managers) are keen to find any weaknesses and problems.  If none are apparent, they will ferret them out.

If OP leaves these off his/her CV, then there will be holes.  If s/he doesn't address the holes in the application essay, then you are leaving it up to the admissions committee to fill in the holes with their imagination.  I presume they will assume the worst.  (In my experience, this can happen even with evidence of accomplishment.)

If these are included in the CV, then official transcripts will have to be submitted (this is standard in the US), and thereby the committee will see the full record, not just GPA for each degree program.  And if s/he doesn't say anything about them in the application essay, the committee will probably draw very negative conclusions from them.

Finally, my suggestion to address the problems and learning in the application essay doesn't mean that it needs to be long or detailed. It could be a couple of sentences: "These degree programs were not as successful as I would have liked, and but thankfully I'm much the wiser now.  I learned what I'm good at and what I'm not good at, and I learned what I really want to do in my career."