For this it should allow both, because we have no idea what gender "it" is. However, if we know which gender "it" is, then we need to use the correct "den/det" in order to reference it. So if it is common gender ("en") then you have to use "den" when talking about it. And "et" and "det" for neuter. There are however cases where "det" is used even when talking about a common gender, this is mostly when using it as "that".
It is difficult to explain, but for it to sound proper without "ved", then I would structure the sentence as follows: "Du rører den ikke". I think the best explanation is that "ved" means that it touches something physically. I am trying to think of counterexamples but cannot come up with any. So if it's touching physically it would be with "ved", but if you touch somebody emotionally, then it would be without. I tagged the team, and hopefully one of them or a kind soul here knows better than me.
Well, it's one of those things caused by the eternal language change. Originally, røre was an intransitive verb, meaning it took only a subject and no object. Similar to how to sleep takes only a subject (you can't say I sleep you) but to punch is transitive (I punch you, subject and object). So in order to attach an object, you had to use a modifier, similar to how you can say I cause you to sleep (but not quite).
Another variant is berøre from the prefix
be- which is a (no longer productive) modifier to turn a verb into a transitive verb (similar to smile - besmile in English. I besmile you - I smile upon/towards you). This prefix is found in a LOT of verbs in modern Danish, similar to Dutch and German (my research tells me).
Today, however, røre is used by many people as a transitive verb with the same meaning as røre ved and berøre. To me, it still sounds a bit strange, but that's just how it is :)
Ahh linguistics in the morning!
In any case this sentence is a bit confusing, because it sounds like a command, but it's actually in the present tense, not imperative. I.e. it means you are not touching it, as a statement, not do not touch it which would be (du) rør ikke ved den.