How should I attach a toilet flange and toilet with this particular situation?
Since there is no flange installed yet you could just fill in the void with materials such as plywood or hardy backer to bring it up close to the level of  The existing floor  then solidly secure the new flange with long screws. 

The wax ring mounting system of a toilet to a flange is fairly forgiving so you do not have to be precise.  You could leave it the way it is and use a  extra thick ring or you could fill it as I suggested and use a single thickness ring or one of the newer rubber  gasket options.  Having the  flange above the level of the tile floor is not necessarily the right thing as this could be problematic in getting the toilet to  sit tight to the tile floor without rocking .  I would shoot for having the top of the flange be at the same level as the tile floor( or slightly lower ).  You want enough gap for the wax ring or mounting system but not so high that it interferes with the toilet. 

There is more than one way to skin a cat, there is no one correct answer for your question. 

Many times when I lay a new bathroom tile floor I am able to unscrew the flange and lift it up and slide the new  cement board underneath it but sometimes that is not possible and I have to use a thicker wax ring or a flange extender.

I saw a new product on this old house that was a thick squishy foam type ring that looks much nicer to use then wax.