Inner join only for not empty values
You have an inner join with a condition there: 

WITH fktable1 (id) AS (
  values (2)
)
,fktable2 (id) AS (
  values (3)
)
SELECT main.*
FROM (
  VALUES
    (1, NULL, NULL),
    (2, 2, NULL),
    (3, NULL, 3),
    (4, 2, 3),
    (5, 4, NULL), 
    (6, NULL, 5) 
) AS main (col1, fkcol1, fkcol2)
  join fktable1 f1 on f1.id = main.fkcol1 or main.fkcol1 is null
  join fktable2 f2 on f2.id = main.fkcol2 or main.fkcol2 is null