Burgundy was, at different times and at times simultaneous, all of a Kingdom, a Duchy AND a County. The Duchy of Burgundy was an integral part of the Kingdom of France, and was NEVER a part of the Kingdom of Burgundy. The County of Burgundy (Franche-Comte) was NEVER a part of the Duchy; it was the northernmost portion of the Kingdom of Burgundy. Are you confused now?
Geographically, the Kingdom consisted of the Rhone Valley, the Duchy corresponds to modern Burgundy, and the County was the border region between France and Switzerland.
The Kingdom of Burgundy was inherited by the Holy Roman Emperor in 1032, and for all essential purposes ceased to exist. Most of the Kingdom became de facto independent, except the County which was definitely under the Emperor's sway. When the Capetian branch that ruled as Dukes died out in 1361, the Duchy was given to a younger brother of the King of France, and thus the Valois Ducal line (the most famous of the Dukes) was born. In 1384 the reigning Valois Duke inherited the County. However, the Duke never did homage to either the King of France (who had no rights in the County) or the Emperor (who did, but was too weak to enforce them) for the County of Burgundy.
The Duke in question, Philip II the Bold, had gained the County by marrying Margaret of Flanders, who also brought Flanders and Brabant and a claim to Holland and Hainault. Philip and his descendents made it something of a (bloody) hobby collecting the remaining provinces in the Low Countries, a process completed by Philip's direct descendent Charles V, who acquired Friesland and Gelre in the 1520's. Soon, a tradition arose where the Low Countries, combined with the Duchy and County, were collectively referred to as "Burgundy". This tradition continued even after the Duchy proper was separated from the rest in 1483, as King Louis XII of France dismembered the Valois Duke's holdings after the death of the last Duke, Charles the Rash, in 1477.
Heck, all that is even more confusing than my first paragraph. Sorry; here's a web site that talks about some of this:
http://www.friesian.com/flanders.htm#burgundy