the literal meaning is " in the distance of three-nine lands" here is what the dictionary says (Russian dictionary, because we have the same idiom in the Russian language)
тридевять 1) Название числа "27" при счёте девятками. (the name of number 27 if you use nonary counting system) 2) Очень далеко. (very far away)
тридевять - только в выражении (used only in the following idiom): за тридевять земель - 1) в отдаленной стране (обычно в сказочных формулах; ) (it means in a far away country, usually used in the fairy tales)