President John Tyler - He died in 1862 and had pledged his allegiance to the Confederate States so his death was never “officially recognized” in Washington and a Confederate flag was draped over his casket. “Some say that he was buried under a foreign flag”.

John Tylercould be considered the only President not only to have died outside U. S. soil,(Richmond Va. 1862) but also to have been buried there. Additionally, Tyler was the only U.S. President to have a Confederate flag draped over his coffin."http://www.anewadventure.org/presidents/PresidentTyler.html

"Because the State of Virginia was part of the Confederate States of America at the time of his passing in 1862, John Tyler could be considered the only President not only to have died outside U. S. soil, but also to have been buried there. Additionally, Tyler was the only U.S. President to have a Confederate flag draped over his coffin."

At the time he died in 1862, former President John Tyler had joined the Confederacy and had been elected to the Confederate Congress. He was buried in Hollywood Cemetery in Richmond using the Confederate flag, not the US flag.

President John Tyler--"Because the State of Virginia was part of the Confederate States of America at the time of his passing in 1862, John Tyler could be considered the only President not only to have died outside U. S. soil, but also to have been buried there. Additionally, Tyler was the only U.S. President to have a Confederate flag draped over his coffin."
Source: http://www.anewadventure.org/presidents/PresidentTyler.html