In Star Trek, the Standard Model seems to be the accepted physical model. Dark matter is detected and even dark matter life forms are encountered in some episodes. In the episode "Where No Man Has Gone Before" they say the Enterprise reached the 'edge' of the galaxy, but, according to my understanding, a huge halo of dark matter is also considered part of our galaxy. If Star Trek accepts this theory, what is considered the edge of the galaxy?
The edge of the galaxy in Star Trek is considered to be the same as what we consider the edge of the galaxy now. Of course, this can be as tricky to define as the edge of our solar system, since some once considered that Pluto's orbit, others consider it to be the outer edge of the Oort cloud, and others consider it to be when the heliosphere tapers off a given amount. In other words, "edge" can be tricky to define. But, in general, the edge of the galaxy, in Trek, is considered to be the line beyond which there are no stars or perhaps only a few stars remaining before the vast gulf that separates our galaxy from others.
So the physical edge of the galaxy would be the same as what we consider it to be.
But if you want more on the barrier, which some would say is the edge, since it surrounds the Milky Way, here it is:
The Galactic Barrier. Essentially the entire galaxy is surrounded by a "negative energy" barrier. The composition of the barrier is not really clear. Originally it's said to be unknown (in Where No Man Has Gone Before), but in By Any Other Name it's said to be made up of "negative energy." The only other time it is actually encountered in canon is in Is There in Truth No Beauty, and it could be argued that what they encounter is not the barrier. (It looks like it, but they don't use that term.) It is never referred to as dark matter. Very little information is given about the barrier and it seems that most writers prefer to avoid the subject, since, in canon, it is only encountered in Star Trek (The Original Series).
The best way to think of the barrier might be that it is like a giant bubble or balloon that surrounds the galaxy. The entire Milky Way is within it.
In non-canon works, specifically Greg Cox's Q Continuum novel series, the Galactic Barrier is explained as a shield put in place by the Q after an encounter with the entity "0" (Zero). 0 is a powerful entity who destroyed the Tkon Empire. The Q put the barrier in place to keep 0 out after 0 had already destroyed the Tkon. The reason the barrier effects people with ESP is because it contains psychic energy from the Q, who created it.
So the galaxy has a physical edge, beyond which there are no or few stars, and outside this edge is the Galactic Barrier, which is like a bubble, that surrounds the galaxy.
(Note: Memory Alpha says the Galactic Barrier joins with the Great Barrier the Enterprise crossed in Star Trek: The Final Frontier, but I've left that out for simplification.)
In By Any Other Name, Spock states, "The barrier we must traverse is negative energy." And, later, "Sensors indicate density negative, radiation negative, energy negative. (Kirk starts chewing his nails with indecision) All instruments off the dials, Captain. We are in contact with the barrier."
So, no, it can't be Dark Matter as the term is understood, tho' it might be Dark Energy.
It's also worth noting that, even at the speeds mentioned in By Any Other Name, even at the 10,000 x C needed to hit Andromeda in under 300 years, it is still 34 weeks to the barrier... the only viable positions for that barrier are either above or below the disk, not the outer edge of the disk, since it's only a couple days before they are approaching it. The episode's first time reference is 4657.5, during prep, and the barrier is hit at Stardate 4658.9, 1.4 stardates later. Per the writer's guide, that's 1.5 days later; 10648 x C (WF22 per the TOS Writers' Guide), they'd only have crossed some 41 light years... not even enough to hit the upper or lower extents of the disk. Perhaps the barrier is between the sub-arms, but even then, 41 light years isn't much.
It seems possible that the Galactic Barrier may be the dark matter halo you're talking about.
In-universe they didn't know the Galactic Barrier existed until they (literally) ran into it in TOS.
Remember, at the moment dark matter is just a theory used to explain why gravity seems to be too strong on the outer edge of the galaxy. There are also other unformed theories about "flexi-gravity" where it actually is stronger in that part of the galaxy for some reason. A Galactic Barrier could just be strong enough to hold the galaxy together as a side effect...
By that means then we know more than all the series put together, and Whilst I am a huge fan of the series. I am quite certain that they knew about the edge of the galaxy when TOS was made. Even if not TNG and Voyager say it will take so many hundreds of years to reach said edge at max warp. Therefore I just don't think that TOS can go oh yeah we reached the end of what we can scan even with all of our tech. And then to another edge in yet another episode. So they just rush across at warp 5 from one edge to another? Warp back then must have been 100X what Warp 5 really is