Prevent combat damages dealt with trample
Yes, the attacking player only has to assign enough damage to the blocking creature for the attack to be lethal, that means damage equal to all the blocking creature's toughness, whether the creatures actually die from combat damage is not strictly necessary. There may be a myriad of ways in which damage may be prevented, but that does not change how the damage is assigned.


  702.19b. The controller of an attacking creature with trample first assigns damage to the creature(s) blocking it. Once all those blocking
  creatures are assigned lethal damage, any remaining damage is assigned
  as its controller chooses among those blocking creatures and the
  player or planeswalker the creature is attacking. When checking for
  assigned lethal damage, take into account damage already marked on the
  creature and damage from other creatures that's being assigned during
  the same combat damage step, but not any abilities or effects that
  might change the amount of damage that's actually dealt. The attacking
  creature's controller need not assign lethal damage to all those
  blocking creatures but in that case can't assign any damage to the
  player or planeswalker it's attacking.