There are a number of different forms of invited talk, but to me, a clear distinction can be made by considering whether the decision to have a person speak comes before or after any associated submission.
If the organizers of the event have decided they want Dr. Smith to speak, based on Dr. Smith's record, and then afterwards negotiate the particulars of topic and content of the talk, then it's an invited talk. There might or might not be any publication associated with it, depending on the particulars of the venue. This covers keynotes, seminars, symposia, and many other forms of talk.
If the organizers ask Dr. Smith to submit something, and then decide whether they want the talk based on what's been submitted, then it's not an invited talk. This is the typical case for conferences, workshops, etc.
What can make things confusing is that the word "invite" is often used in solicitations for submissions of the second type, particularly by low-quality or predatory organizations that are trying to trick people into thinking it's an invited talk, rather than just another request for submissions.
If the judgement comes after the submission, however, it's definitely not an invited talk---and if the judgement comes before because it's a terrible venue, then you shouldn't go even if it would give you an "invited talk" line on your CV.