Knives are dangerous not only for their killing potential, but because often, the victim doesn't even know there's a knife in play until they've been stabbed or cut several times. Odds are, if someone deploys a knife and lets you see it, they're just threatening you. If their plan is to stab you, chances are good that you'll already be stabbed before you know he's got a knife.
Once you know your attacker has a knife, and retreat isn't an option (you should try to retreat first, if at all possible), then the first thing you should do is to find an equalizer. Find something either long enough to keep your attacker at bay or broad enough to use as a shield. A chair or stool accomplishes both objectives. At the very least, you can wrap a jacket, if you have one, around one arm and use it as a shield. I've seen some instructors demonstrate how to use a shoe or a belt in knife defense, but I'm not a big fan of either, as both take some time to deploy (how do you get your shoe from your foot to your hand?) and have some utilitarian problems (how reliable is a flexible belt for wrapping up a speeding fist?)
If you have no equalizer, you must first think about protection. Hold your arms in close, fingers up (vertical forearms) and with your palms facing inward. This protects your tendons and arteries on the inside of your forearm. Hunch down a bit to make yourself a smaller target. Tuck your chin to protect your throat and carotid arteries. Keep your hands near your face. This basic position is similar to boxing's "peekaboo" guard, employed by the likes of and early Mike Tyson or Floyd Patterson. Use the back of your forearm to block or deflect incoming shots.
A lot of martial arts will demo knife disarms from a distance, using an X-block against a giant swing. If your opponent is stupid, they might do this. An X-block is performed by crossing your forearms in the shape of an X and blocking with the outside of them. It's best used when defending an overhand "Psycho" swing or an underhand swing with a knife. Assuming your stop the attacker's momentum with this block (you probably won't, but hey...) you can turn one or both blocking hands over, take control of their attacking arm, and either counter attack with your free limbs (feet, head) or go for a disarm. The most common two-handed disarms are to either twist the knife out of the attacker's hand by driving it towards the thumb (two methods: either grabbing the hilt, which I recommend, or using the forearm against the flat of the blade, which I don't), or by raking along the inside of the attacker's palm and pulling the knife out.
A lot of people will tell you not to clinch with a knife wielding opponent. I'm not one of those guys. The idea is that you're going to get cut anyway, so just accept it, man up, and clinch with them. At least in the clinch, it's easier to control the attacking arm, unlike at a distance. Clinching in this case takes timing. You have to wait until your attacker has either wound up for a big shot or has just missed with an overcommitted swing. You don't reach out and paw at them with your hands; instead, from your peekaboo guard, you step your leg in deep and crash into them. Drive into them as if you were in a burning building and had to crash through a wall to escape. If you knock them over, run away. If you simply connect with their body, use your arms, from their high-and-tight position, to search for a control on their attacking arm. From there you can disarm them, or break their elbow or wrist if you're versed in joint locks. But make it quick. They've got a free hand, and if they have any sense at all, won't just sit there and let you take their toy away.
The fact is that if you're facing a knife, you'll probably get cut. The good news is that after the immediate threat is over, you can put pressure on the wound and get to the hospital. Also, the number of places where knife wounds are almost immediately fatal is a bit limited. Getting stabbed in the shoulder or intestines sucks, but isn't nearly as bad as getting stabbed in the neck or heart.
Finally, there are some people out there who are really good with a knife. They'll probably be prepared for the stuff I've listed here. Some guys are just that good that if you face them, in their element, you'll probably die. That's just a fact.