Good question. DotA is a team game, with each hero playing a different role. Some heroes are meant to be farming and others are not. Carries such as Beastmaster, Juggernaut, Mirana, Kunkka etc farm the best and are meant to do so in order to tank in the late game. I'm going to assume that you are playing one of these heroes, and that your team is nicely balanced with other heroes playing the other roles. In that case:
Early game, do not leave your lane to
gank too often. Once or twice early
if you are the solo is ok, but
remember that the longer you are out
of lane, the more XP and gold you
lose. It's doubly bad if your
opponent is still in lane getting the
XP and gold that you would've denied. Stay in your lane and FARM FARM FARM. See the section at the end about support heroes though - they can afford to run around a bit more.
Later on in the game, farm in between
the big team moments... when the
other team isn't about to knock down
a tower, and when your team isn't
trying a big push.
When a bunch of their creep attack
one of your towers but none of your
opponents are around is always great.
This may happen mid to late-game when
your team has just abandoned a big
push far into the other side of the
map. The other team will be busy
mopping up the creep that are in or
near their base... if you teleport
back to your tower quickly, you
should be able to get more gold out
of the creep than the cost of the
scroll.
Jungling / Neutralling can be good
when there are no waves of enemy
creep nearby. It is better to do this
than to push with a wave into an area
of the map where you will be ganked.
Always watch the minimap when
farming... if you can't see their
heroes, they are coming to gank you.
Same rules about teamwork apply -
don't go farm the neutrals when your
team is pushing together or they will
rightfully hate on you. The only
exception would be if you are the
carry and your team can do ok without
you for a little while.
If you aren't playing a carry: support heroes like Lion, Warlock etc should be denying/harassing/ganking and NOT taking gold from the carries. If you only have 2 bracers and boots on level 10 but you've been planting wards the whole game, your team will love you. If on the other hand you last hit ten creep with Lion's stun spikes when there's a Nerubian Weaver around that could've put the gold to better use, you'll be very unpopular.
So know what your role is in the team, and don't try to play a role that your hero isn't intended for. A lot of the dbaggery is misdirected rage from people who don't know how to express their frustration that you aren't playing the team role the way their friends do.
Disclaimer: in low level games / LANs people often get the team aspects of DotA wrong, so you may see heroes be played in the wrong roles, or not be used to being ganked so frequently. In those games you should just pick a carry and outfarm everyone.