There are a number of threads on here regarding that same question. I myself have had to consider this. I think the answer varies on a number of things such as your age, when you plan to retire, how much you have to invest, etc. The following are my thoughts.
1. A smart investor will usually try to create multiple streams of income. Stock investing is one of those streams even though it may not seem like it when it is sitting in an account. You never know what life throws your way. When you turn 59.5, you may be really glad to have a chunk of change you can access if life does not go the way you planned in your 40's and 50's. You may be able to even access it earlier without a penalty given various conditions.
2. If your company matches, then the free money is definitely a plus and should be strongly considered. You should at least invest up to what is matched. Of course if you do not plan on being at the company long enough to become vested, then this would not be a factor. However, even the tax deferral alone is a pretty compelling reason to contribute at least something.
3. When you start buying rental houses, lenders will usually want to see 3 to 6 months of expenses saved up somewhere. You can use the money you have in your 401(k) to meet this requirement without having to withdraw it.
4. Most plans will let you borrow against your 401(k). Many have used this as part of their real estate investment strategy.
Overall, I believe it is good to invest at least something in your 401(k).
Dave Garlick