Your second example must be 'an dem Tisch'. But 'an dem' is usually expressed as 'am' in german, so your first sentence would actually be 'an dem den Tisch'. Dugolingo got it right.
Duo always marks you wrong if you don't put the 'the' in your answer when they've specifically written it and this time they've missed it out themselves!! Grr