You know the part of the join that must always be true - the first column. You handle the second column outside of the join, in the WHERE clause:
SELECT A.col1, B.col3
FROM A
INNER JOIN B ON A.col1 = B.col1
WHERE (A.col2 = B.col2)
OR ((B.col2 IS NULL) AND
NOT EXISTS (SELECT x.* FROM B x WHERE x.col1 = A.col1 AND x.col2 = A.col2))