It's all the damage dice that come specifically from hitting with the attack.
There isn't a clear and easy standard for this that applies across the board, but in general "the damage roll" is all the dice that apply to the attack, once you've factored in sneak attacks, smites, certain spells, or any other effects that the player gets to add in.
However, the damage roll should not include any damage that's behind a saving throw triggered by the hit, such as poison. If the attack makes the target roll a save, any damage subsequent to that is related to the result of that saving throw, not to the attack. Those should not be considered part of the attack at all -- they wouldn't be double-rolled on a critical hit, for example.
Poison (and related effects)
For Injury-type poisons, the rules given in the DMG (p.257) are pretty clear about whether the poison is part of the attack's damage roll:
A creature that takes piercing or slashing damage from an object coated with the poison is exposed to its effects.
Taking damage only happens after you've already rolled the damage roll for the attack, adjusted it, and figured out what the target is actually going to take. That damage is the trigger for exposure to the poison, after which "a creature subjected to the poison" (common language used in all the poison descriptions) must make a save, and in many cases takes damage on a failure (and sometimes a lesser effect even on a success).
Here, you don't even know if the target needs to roll a save until you know if you did any damage. Your target might secretly be a werewolf and immune to the piercing damage from your non-magical non-silver dagger. You might be fighting a guy with the Heavy Armor Mastery feat and really flub your damage roll so that you didn't even scratch him. No injury, no injury poison.
Now, some add-on effects that include a save aren't based on actually taking damage, just being hit by the attack, like contact poisons or certain magical abilities. I would still say those damage rolls are a whole separate thing, though; again, the effect is brought about by failing a saving throw, not from being hit by the attack roll.
The most common place to see this is in venomous monsters. The scorpion's sting, for instance, seems to require you to make the poison save even if you nullify the 1 damage from its initial attack (such as if you have the Heavy Armor Mastery feat or resistance to piercing damage, since resistance means you halve the 1 damage and then round down to 0). I would say a DM should rule that it doesn't work that way, but in any case: The damage from the poison comes from failing a saving throw, not from being hit by the attack, so it shouldn't count as part of the damage roll for the attack. As an odd consequence of this, a scorpion that crits you doesn't deal any extra damage; the initial 1 damage doesn't have a die associated with it, so there's no roll to double, and the poison is a separate damage roll based on a saving throw, so it doesn't get doubled either.
Note that some dangerous monsters don't work that way. For example, the Basilisk just deals "2d6+3 piercing damage plus 2d6 poison damage" with its bite -- the poison is not a separate save; it seems to be an innate part of the attack's damage, so it's part of the single damage roll, the same as if you had a flaming sword.
When does the damage minimum apply?
As you quoted, the rule is "with a penalty, it is possible to deal 0 damage, but never negative damage". Damage dealt is at the end, the actual number you're going to subtract from the target's HP total. The minimum, therefore, applies at the very end of the process -- after every adjustment has been done and you're ready to change the target's HP, you just make sure you aren't about to do something silly like add HP because you somehow dealt less than no damage.