Latvia & Estonia border Russia yet they were able to join along with five other nations in 2004. Why couldn’t Ukraine had done the same in 2004 or any other year while Russia was not paying much attention to NATO?
This is going to be difficult to answer not only because it's a "why didn't x happen" and because of the 20 year rule.
Keeping both in mind - as for why Ukraine didn't aspire to join NATO in the 1990s through 2002, during the period when countries like Poland, the Baltics, or the Czech Republic did have stated policies to join the alliance, there are a few factors in play. A major one is that it just scored incredibly low on Ukrainians' radars. Polls from the late 1990s showed that interest in NATO membership, or in joining pretty much any international organization, were incredibly low on regular Ukrainian people's minds compared to economic issues, which makes sense given that Ukraine was going through a massive economic disruption caused by the end of Soviet central planning (the Ukrainian economy still technically hasn't recovered to 1991 levels). This general lack of interest went hand-in-hand with low Ukrainian media coverage of such topics, and a feeling among the Ukrainian political elite that since membership was such a remote prospect (it should be noted that even Poland, the Czech Republic and Hungary were not invited to join NATO until 1997, and didn't become members until 1999 - Slovakia was noticeably not invited in this round because of perceived undemocratic tendencies of it's then-Prime Minister Vladimir Meciar), it really wasn't an issue worth addressing. Even that NATO expansion was strongly opposed by Russia, which already also spoke of Ukraine (and other former Soviet states) in terms of a "Near Abroad", not quite separate from the Russian sphere. The West itself at this time didn't necessarily see Ukraine as completely independent from Russia, and usually subordinated concerns about the former to focus more directly on the latter.
On top of this, there was a consistent minority that was against NATO membership when pollsters pressed on the topic. When asked in 1997 if Russia's opposition to NATO expansion was justified, 24.8% of Ukrainian respondents said yes, 55.2% of respondents didn't know, and only 20% said no. Similar numbers said that NATO expansion to include Ukraine would be against Ukrainian interests and contradict its Non-Aligned status. Indifference really was the order of the day across the country, but on top of this resistance to Ukrainian membership in NATO was especially strong in Crimea and Eastern Ukraine (especially the Donetsk region) where almost 50% of respondents opposed NATO membership, while Western Ukraine showed much stronger favorability to NATO membership. Ethnic Russians - concentrated in Crimea and eastern Ukraine, also tended to be more hostile to the idea of NATO membership. Regardless of their feeling, Ukrainians who saw international relations as a pressing issue numbered in the single digits - it just wasn't a pressing concern.
On top of this, the political landscape of Ukraine was very different in the 1990s from today, and was very similar to what was happening in Russia at the time. In the 1994 and 1998 elections the largest number of party seats went to the Communist Party of Ukraine (86 out of 450 in 1994, and 121 out of 450 in 1998). The KPU (which was more heavily based in the Ukrainian south and east) looked very fondly on the Soviet period and not very fondly at all on the West. This was a major political bloc against greater integration with NATO and in favor of closer ties with Russia. Ironically, worsening Ukrainian-Russian relations led in part to the political downfall of President Leonid Kravchuk and his defeat in 1994 by Leonid Kuchma, elected with strong support from the south and east, and favoring better ties with Russia. Kuchma began to move towards a more independent-minded foreign policy, but moved towards unoffiical cooperation with NATO, joining the Partnership for Peace program and signing a partnership charter with the alliance in 1997. But still because of political considerations, the official position was that Ukraine was a neutral state, and even when President Kuchma (after his 1999 reelection) pushed for closer ties with the West, it was specifically with the EU rather than NATO, again reflection a greater popular concern about economic matters.
In short - there were big regional and ethnic constituencies opposing involvement with NATO in the 1990s and early 2000s in Ukraine, and most Ukrainians were far more concerned about economic issues than what were perceived as international matters. As a postscript, even well into the 2000s there was close division in public opinion between supporters and opponents of NATO membership, and a clear and overwhelming majority favoring NATO membership is something that is extremely recent to Ukrainian public opinion - like, in the last year or so - and highly shaped by events since 2014 which are beyond the scope of this sub.
This information and more can be found in a 2000 study titled "The Effect of NATO Partnership with Ukraine on Inter-Ethnic Relations within the Country" by Sergey Khrychikov available here