this kind of macro is a plain tex construction, and is called a "delimited macro". it is discouraged in latex, at least partly because it's easy to make mistakes.
here's an example that does what you ask:
\documentclass{article} \def\dd #1,#2 {\frac{\mathrm{d} #1 }{\mathrm{d} #2 }} \begin{document} \thispagestyle{empty} $\dd f,x $ \end{document}

observe that if you omit the space after the second argument in the input
$\dd f,x$
you will get an error:
! Missing } inserted. <inserted text> } l.5 $\dd f,x$
however, not having a definitive "closer" limits the recognition of the argument to a single input token, which could be very limiting, although not for this example.
edit: in response to a request for a similar delimited macro in which arguments can be optional, here is the same one, modified for that purpose. in this particular case, all that is required is for every argument to be clearly delimited.
\documentclass{article} \def\dd #1,#2;{\frac{\mathrm{d} #1 }{\mathrm{d} #2 }} \begin{document} \[\dd f,x; \quad \dd ,x; \quad \dd ,; \] \end{document}

in this case, where each argument is likely to be only one letter or control sequence (e.g. \phi), omission of an argument simply omits it from the output. (just don't type a period instead of a comma, as i did when setting up the example.)
in more complicated situations, where multi-character strings would be the arguments, the possible presence of punctuation in an argument means that the choice of delimiters must be made with much more care; in such cases, one could also enclose affected arguments in braces to make them appear as a single tokan to (la)tex, as suggested in a comment by @SeanAllred.
and, if this macro is to be used in text, rather than in math, be very careful about spaces in the expansion.
\dd[f, x]be acceptable as an alternative?\defis definitely worthwhile in some situations, and preferable to braces, but this is not one of them.