The core rule
If you are in Australia and your visa was refused or cancelled (or a previous visa was refused while you were onshore), you cannot apply for most further visas while onshore. You must leave Australia to apply, unless an exception applies.