Diamond Weapon's prevention effect isn't considered while assigning combat damage from a creature with trample that's being blocked by Diamond Weapon. For example, if it blocks a 12/12 creature with trample, that creature's controller must assign at least 8 of that creature's combat damage to Diamond Weapon, and the remainder can be assigned to the defending player, planeswalker, or battle.