Instead of telling the student that he or she will fail, and thereby making a judgement of them at your own prerogative, you could delegate this difficult judgement to the student's own mind.
Doubtless you do not baselessly decide a student will fail or not on a whim, you have some sort of logic. Even in your question you have hinted at the logic: They have poor knowledge of even the syllabus and seem to be at such a low level that they are unlikely to cover all the material in the time that remains. Also, sometimes instructors who have seen dozens or hundreds of students develop an intuition for the sort of student who will do well or badly, just based on how the student is acting. This may not always be 100% correct, but in my experience is often quite informative. Rarely have I seen an instructor claim that student X will do badly, after which student X will perform well in spite of expectations (note, I say "rarely", which means exactly that - not never, but not often).
Take the logic, and the facts you are basing your thinking on, and explain these to the student. Do not conclude that they will fail or not, let them judge for themselves how likely they are to succeed, how much work it will take, and whether they are willing to do that work.
For instance:
- "You were consistently in the bottom 10% of the class in the last 5 quizzes - in my experience, it is very uncommon for a student to suddenly improve in the exam after a run like this - I have never seen it happen having taught about 400 students."
- "You have missed 60% of the lectures - in my experience, students who miss that many days have a lot of difficulty dealing with the exam, because class discussions are directly relevant to the exam questions."
- "You don't seem to know the syllabus very well, but this is a very comprehensive exam. Students who don't know the syllabus would have a lot of trouble getting up to speed with the material in a timely manner."
- "The exam is soon and there is a lot of material to cover - do you think you will be able to manage it all in time?"
After explaining your reasoning, make sure to finish with something like "If you want to succeed in this course, you would likely need to work very hard, based on what I've told you".
Advantages of this:
- It is honest and treats the student like an adult, not a child, letting them make their own decisions about their life. The responsibility for the decision is likewise placed on the student, not you.
- If the student is a genius who can succeed anyway, they are free to disregard your advice, and nothing you said is falsified even if they do since you only advised them of heuristics and probabilities.
- If the student indeed fails as you suspect, you have not told them a comforting lie about how they will "get an A".
- Limited self-fulfilling prophecy effect - you do not tell the student that they cannot succeed, thereby killing their motivation and thus ability to succeed, you are only giving them an idea of their odds.
- If the student is enlightened by the information you provide, they have the opportunity to steer the discussion in a direction they are comfortable with: Those who feel they have the mental fortitude can say "I'm gonna fail, won't I?". Those willing to rise up to the challenge can say "This sounds like it will be a very tough exam, what do you think I can do to improve my odds?".
The disadvantage is that some people may feel that full, unconditional confidence in a student's potential (even in spite of the facts) is necessary for optimal learning outcome. If you subscribe to this notion, you are effectively doing a disservice to the student, by not giving them the most optimistic version (and instead giving a sober, realistic version). The decision here is whether you subscribe to it, which is for you to resolve.