That is known as volley or “obstruction”, and it’s an illegal shot in table tennis. If you do this, you lose the point. To make it easier to remember, let’s put it like this: you are not allowed to hit the ball while it’s on its way to bouncing on the table.
Are You Allowed to hit the ball During its way down?
A. You got permission from your opponent beforehand (for instance, if they asked you to play a “let” so they can better position themselves).
B. The ball is about to bounce on the side-line line(s) of the table and it would be impossible to return it otherwise (e.g.: there is no space left for your opponent outside the limits of the table).
C. The ball has landed on your half of the table, and you are standing inside the limits of this half when returning it (you can also stand slightly beyond those limits as long as you don’t lean over them; but as soon as you do, it becomes a let).
D. The ball is about to bounce on the side-line line(s) of your half of the table and it would be impossible to return it otherwise (e.g.: there is no space left for yourself outside the limits of this half).
E. The ball is about to bounce on either of the singles lines of your half of the table, and it would be impossible to return it otherwise (e.g.: there is no space left for yourself outside the limits of this half).
F. The ball has landed on your half of the table, and you are standing between a singles line and a centre line when returning it (you may lean over these latter lines but only up to a point from which you can reach the ball with your hand).
In case E or F above, you should not let the ball bounce more than once at most on any one of those lines; if it bounces twice or more, then this becomes a let. In addition, if in attempting to return the ball you hit it with your hand or arm then this becomes a let. You are allowed to have your racket touch the ball but only once; if the ball bounces on it more than once, then this becomes a let (you can still play the ball by hitting if not more than once).
Related Guide: What are Ping Pong Tables Made of?
Single Line and Center Line:
I believe that as long as you’re standing between a singles line and center line (and within those lines), you may volley the ball back if you stay hit it first before it touches anything else. I think I remember reading somewhere that as soon as its first bounce is outside of those lines, volleying is no longer allowed… But I might be wrong.
Could You volley in ping pong when the opponent hits a powerful shot?
Yes. If your opponent hits a powerful shot at you on a table tennis court that returns to your end of the table with maximum downward speed and depth, you can usually return it without letting it bounce first, and sometimes without even hitting the ball on the rise. If you do not hit it back cleanly, or let it bounce once before returning it, then a point is awarded to your opponent.