Muscle twitching (fasciculation) can be caused by a number of things. Because your twitching is localized to the area of your knee, it is most likely due to an injury to a nerve or muscle around your knee.
Other causes of muscle twitching can be a magnesium deficiency (which can be checked by a simple blood test) or by dehydration or fatigue. Your doctor may also want to check for other chemical imbalances, thyroid disorder, or stress factors.
Medications such as albuterol inhalers (used for asthma) or other stimulants such as pseudoephedrine (Sudafed) or even excessive caffeine intake can cause twitching. Some medications that are used for attention deficit disorder have also been known to have this side effect.
If this twitching persists, you might want to see a neurologist for a complete neurological exam and possibly testing for Benign Fasciculation Syndrome (BFS.) Testing might include an EMG (electromyography), Nerve Conduction Velocity tests (NCV.) These tests are often done together and can diagnose nerve or muscle damage. MRI and other radiology testing may also be of help in diagnosing the cause of the twitching.