First, defined? something will return type of something, and in this case something is positionRight && positionRight that mean this is an "expression", so your logic will fall into "custom-css-class" not empty css as you said, since "expression" ? will always fall into truthy case.
Second, your logic just has 2 cases: true or the rest (false, nil), so no matter you set positionRight (true, false) or not set, the code below should ok:
positionRight ? "custom-css-class" : ""
Last but not least, in case you want more than 3 cases: positionRight is defined: true or false or even nil, and positionRight is not defined, then you now could use defined? as below code:
defined?(positionRight) ? (positionRight ? "css-align-right" : "css-align-left") : ""